# lv_image_cache.h (/api/misc/cache/instance/lv_image_cache_h)



<ApiSummary functions="6" />

Functions [#functions]

<ApiMember kind="function" name="lv_image_cache_init" file="misc/cache/instance/lv_image_cache.h" line="36" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/cache/instance/lv_image_cache.h#L36">
  lv_image_cache_init [#lv_image_cache_init]

  Initialize image cache.

  ```c title=" " lineNumbers=1
  lv_result_t lv_image_cache_init(uint32_t size)
  ```

  <span className="sr-only">
    Parameters
  </span>

  | Name   | Type                        | Description                 |
  | ------ | --------------------------- | --------------------------- |
  | `size` | <ApiLink name="uint32_t" /> | size of the cache in bytes. |

  **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: initialization succeeded, LV\_RESULT\_INVALID: failed.
</ApiMember>

<ApiMember kind="function" name="lv_image_cache_resize" file="misc/cache/instance/lv_image_cache.h" line="44" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/cache/instance/lv_image_cache.h#L44">
  lv_image_cache_resize [#lv_image_cache_resize]

  Resize image cache. If set to 0, the cache will be disabled.

  ```c title=" " lineNumbers=1
  void lv_image_cache_resize(uint32_t new_size, bool evict_now)
  ```

  <span className="sr-only">
    Parameters
  </span>

  | Name        | Type                        | Description                                                                                              |
  | ----------- | --------------------------- | -------------------------------------------------------------------------------------------------------- |
  | `new_size`  | <ApiLink name="uint32_t" /> | new size of the cache in bytes.                                                                          |
  | `evict_now` | <ApiLink name="bool" />     | true: evict the images should be removed by the eviction policy, false: wait for the next cache cleanup. |
</ApiMember>

<ApiMember kind="function" name="lv_image_cache_drop" file="misc/cache/instance/lv_image_cache.h" line="50" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/cache/instance/lv_image_cache.h#L50">
  lv_image_cache_drop [#lv_image_cache_drop]

  Invalidate image cache. Use NULL to invalidate all images.

  ```c title=" " lineNumbers=1
  void lv_image_cache_drop(const void *src)
  ```

  <span className="sr-only">
    Parameters
  </span>

  | Name  | Type           | Description                 |
  | ----- | -------------- | --------------------------- |
  | `src` | `const void *` | pointer to an image source. |
</ApiMember>

<ApiMember kind="function" name="lv_image_cache_is_enabled" file="misc/cache/instance/lv_image_cache.h" line="56" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/cache/instance/lv_image_cache.h#L56">
  lv_image_cache_is_enabled [#lv_image_cache_is_enabled]

  Return true if the image cache is enabled.

  ```c title=" " lineNumbers=1
  bool lv_image_cache_is_enabled(void)
  ```

  **Returns:** <ApiLink name="bool" /> — true: enabled, false: disabled.
</ApiMember>

<ApiMember kind="function" name="lv_image_cache_iter_create" file="misc/cache/instance/lv_image_cache.h" line="62" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/cache/instance/lv_image_cache.h#L62">
  lv_image_cache_iter_create [#lv_image_cache_iter_create]

  Create an iterator to iterate over the image cache.

  ```c title=" " lineNumbers=1
  lv_iter_t * lv_image_cache_iter_create(void)
  ```

  **Returns:** <ApiLink name="lv_iter_t" display="lv_iter_t *" /> — an iterator to iterate over the image cache.
</ApiMember>

<ApiMember kind="function" name="lv_image_cache_dump" file="misc/cache/instance/lv_image_cache.h" line="67" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/misc/cache/instance/lv_image_cache.h#L67">
  lv_image_cache_dump [#lv_image_cache_dump]

  Dump the content of the image cache in a human-readable format with cache order.

  ```c title=" " lineNumbers=1
  void lv_image_cache_dump(void)
  ```
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_types.h&#x22;]" includedBy="[&#x22;lv_cache_instance.h&#x22;]" transitiveIncludes="[&#x22;lv_conf_internal.h&#x22;, &#x22;lv_conf_kconfig.h&#x22;]" />
