Lines Matching full:cache

24 int log_cache_init(struct log_cache *cache, const struct log_cache_config *config)  in log_cache_init()  argument
26 sys_slist_init(&cache->active); in log_cache_init()
27 sys_slist_init(&cache->idle); in log_cache_init()
34 /* Ensure the cache has at least one entry */ in log_cache_init()
41 sys_slist_append(&cache->idle, &entry->node); in log_cache_init()
45 cache->cmp = config->cmp; in log_cache_init()
46 cache->item_size = config->item_size; in log_cache_init()
47 cache->hit = 0; in log_cache_init()
48 cache->miss = 0; in log_cache_init()
53 bool log_cache_get(struct log_cache *cache, uintptr_t id, uint8_t **data) in log_cache_get() argument
60 SYS_SLIST_FOR_EACH_CONTAINER(&cache->active, entry, node) { in log_cache_get()
62 if (cache->cmp(entry->id, id)) { in log_cache_get()
63 cache->hit++; in log_cache_get()
68 if (&entry->node == sys_slist_peek_tail(&cache->active)) { in log_cache_get()
76 sys_slist_remove(&cache->active, prev_node, &entry->node); in log_cache_get()
77 sys_slist_prepend(&cache->active, &entry->node); in log_cache_get()
79 cache->miss++; in log_cache_get()
81 sys_snode_t *from_idle = sys_slist_get(&cache->idle); in log_cache_get()
87 sys_slist_remove(&cache->active, prev_node, &entry->node); in log_cache_get()
97 void log_cache_put(struct log_cache *cache, uint8_t *data) in log_cache_put() argument
102 sys_slist_prepend(&cache->active, &entry->node); in log_cache_put()
105 void log_cache_release(struct log_cache *cache, uint8_t *data) in log_cache_release() argument
110 sys_slist_prepend(&cache->idle, &entry->node); in log_cache_release()