# Cache Behavior

Various objects cache expensive to compute/fetch data (**image**, **gif**, **skin\_3d**, **head\_3d**, **etc.**) for better performance and reduced memory consumption. However, in cases where the data being cached is unique, local caching is a better solution. If the unique cached data (like per player images) accumulates in cache over time, it will result in high memory consumption.&#x20;

**Cache Behavior Modes**

* **Global**
  * Best option for static data, like image or gif files, or other data that is used commonly.
  * Only gets cleared when [/**ib reload**](/docs/getting-started/commands-and-permissions.md#commands) is executed.
* **View**
  * Best option for unique/dynamic data, that would not be reused after the player leaves.
  * Gets cleared together with the board view getting cleared. The exact behavior of this depends on the **reset-radius-on-exit** ([General](/docs/board-settings/general.md)) setting. If **reset-radius-on-exit** is set to true, the cache will get cleared as soon as the player exits the radius of the board. If it is set to false, the cache will clear after the player leaves the server.

Every board object that stores data has the `cache-behavior:` setting.

{% tabs %}
{% tab title="Locally cached image" %}

```yaml
## image1 is an example of a dynamically fetched image.
## Since the image is unique to each player in this example, it is important 
## that the image is cleared from cache after the player leaves the server.
image1:
  type: image
  size: 512 512
  ## the cache behavior setting (global, view)
  ## in this case set to view (global is the default)
  cache-behavior: view
  image:
    ## example image URL that is unique to each player
    name: 'https://example.com/statistics/%player_name%/summary-image.png'
```

{% endtab %}
{% endtabs %}


---

# 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://interactiveboard.gitbook.io/docs/objects/general-information/cache-behavior.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.
