lv_cache.h

API reference for lv_cache.h

Report on GitHub
See Also: Private HeaderThis header has a companion private implementation with internal data structures.lv_cache_private.h

Functions

lv_cache_set_max_size

Set the maximum size of the cache. If the current cache size is greater than the new maximum size, the cache's policy will be used to evict entries until the new maximum size is reached. If set to 0, the cache will be disabled.

 
void lv_cache_set_max_size(lv_cache_t *cache, size_t max_size, void *user_data)
Parameters
NameTypeDescription
cachelv_cache_t *The cache object pointer to set the maximum size.
max_sizesize_tThe new maximum size of the cache.
user_datavoid *A user data pointer that will be passed to the free callback.

But this behavior will happen only new entries are added to the cache.

lv_cache_set_compare_cb

Set the compare callback of the cache.

 
void lv_cache_set_compare_cb(lv_cache_t *cache, lv_cache_compare_cb_t compare_cb, void *user_data)
Parameters
NameTypeDescription
cachelv_cache_t *The cache object pointer to set the compare callback.
compare_cblv_cache_compare_cb_tThe compare callback to set.
user_datavoid *A user data pointer.

lv_cache_set_create_cb

Set the create callback of the cache.

 
void lv_cache_set_create_cb(lv_cache_t *cache, lv_cache_create_cb_t alloc_cb, void *user_data)
Parameters
NameTypeDescription
cachelv_cache_t *The cache object pointer to set the create callback.
alloc_cblv_cache_create_cb_tThe create callback to set.
user_datavoid *A user data pointer.

lv_cache_set_free_cb

Set the free callback of the cache.

 
void lv_cache_set_free_cb(lv_cache_t *cache, lv_cache_free_cb_t free_cb, void *user_data)
Parameters
NameTypeDescription
cachelv_cache_t *The cache object pointer to set the free callback.
free_cblv_cache_free_cb_tThe free callback to set.
user_datavoid *A user data pointer.

lv_cache_set_name

Give a name for a cache object. Only the pointer of the string is saved.

 
void lv_cache_set_name(lv_cache_t *cache, const char *name)
Parameters
NameTypeDescription
cachelv_cache_t *The cache object pointer to set the name.
nameconst char *The name of the cache.

Dependencies

How is this guide?

Last updated on

On this page