# MemoryCache

Memory cache for preloading and reusing the avatars.EnochAvatar**MemoryCache** is used to preload avatars and store the cached skeletal meshes. Cached avatars will be instantiated instantly. It's mainly used for preloading the avatars in the background.

### Properties <a href="#properties" id="properties"></a>

| Property      | Type                            | Description                                                       |
| ------------- | ------------------------------- | ----------------------------------------------------------------- |
| CachedAvatars | TArray\<FAvatarMemoryCacheData> | The avatar URL or shortcode used to load the avatar from the web. |

### Public Functions <a href="#public-functions" id="public-functions"></a>

| Function                                                                                                                                | Returns                | Text                                                                                                                     |
| --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `Preload(const TArray& PreloadDataList, const FAvatarPreloadCompleted& OnPreloadCompleted)`                                             | void                   | Preloads the avatar data so the avatars would be instantiated instantly when loading them from the EnochavatarComponent. |
| `GetAvatarCacheData(const FString& Url, U`Enochavatar`AvatarConfig* AvatarConfig) const`                                                | FAvatarMemoryCacheData | Returns the preload avatar data for a specific avatar.                                                                   |
| `AddAvatar(const FString& Url, U`Enochavatar`AvatarConfig* AvatarConfig, USkeletalMesh* SkeletalMesh, const FAvatarMetadata& Metadata)` | void                   | Adds an already loaded avatar to the memory cache.                                                                       |
| `RemoveAvatar(const FString& Url)`                                                                                                      | void                   | Removes specific avatar data from the memory cache.                                                                      |
| `RemoveAvatar()`                                                                                                                        | void                   | Clears all avatars from the memory cache.                                                                                |

​


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://enoch-app.gitbook.io/enoch/api-references/unreal-engine-sdk/memorycache.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
