Lines Matching full:cache
22 int log_cache_init(struct log_cache *cache, const struct log_cache_config *config) in log_cache_init() argument
24 sys_slist_init(&cache->active); in log_cache_init()
25 sys_slist_init(&cache->idle); in log_cache_init()
34 sys_slist_append(&cache->idle, &entry->node); in log_cache_init()
38 cache->cmp = config->cmp; in log_cache_init()
39 cache->item_size = config->item_size; in log_cache_init()
40 cache->hit = 0; in log_cache_init()
41 cache->miss = 0; in log_cache_init()
46 bool log_cache_get(struct log_cache *cache, uintptr_t id, uint8_t **data) in log_cache_get() argument
53 SYS_SLIST_FOR_EACH_CONTAINER(&cache->active, entry, node) { in log_cache_get()
55 if (cache->cmp(entry->id, id)) { in log_cache_get()
56 cache->hit++; in log_cache_get()
61 if (&entry->node == sys_slist_peek_tail(&cache->active)) { in log_cache_get()
69 sys_slist_remove(&cache->active, prev_node, &entry->node); in log_cache_get()
70 sys_slist_prepend(&cache->active, &entry->node); in log_cache_get()
72 cache->miss++; in log_cache_get()
74 sys_snode_t *from_idle = sys_slist_get(&cache->idle); in log_cache_get()
80 sys_slist_remove(&cache->active, prev_node, &entry->node); in log_cache_get()
90 void log_cache_put(struct log_cache *cache, uint8_t *data) in log_cache_put() argument
95 sys_slist_prepend(&cache->active, &entry->node); in log_cache_put()
98 void log_cache_release(struct log_cache *cache, uint8_t *data) in log_cache_release() argument
103 sys_slist_prepend(&cache->idle, &entry->node); in log_cache_release()