ccv

A Modern Computer Vision Library

View the Project on GitHub liuliu/ccv

lib/ccv_cache.c

This class implements a trie-based lru cache that is then used for ccv application-wide cache in ccv_memory.c.

ccv_cache_init

void ccv_cache_init(ccv_cache_t *cache, size_t up, int cache_types, ccv_cache_index_free_f ffree,...)

Setup a cache strcture to work with.

ccv_cache_get

void* ccv_cache_get(ccv_cache_t *cache, uint64_t sign, uint8_t *type)

Get an object from cache for its signature. 0 if cannot find the object.

return: The pointer to the object.

ccv_cache_put

int ccv_cache_put(ccv_cache_t *cache, uint64_t sign, void *x, uint32_t size, uint8_t type)

Put an object to cache with its signature, size, and type

return: 0 - success, 1 - replace, -1 - failure.

ccv_cache_out

void* ccv_cache_out(ccv_cache_t *cache, uint64_t sign, uint8_t *type)

Get an object from cache for its signature and then remove that object from the cache. 0 if cannot find the object.

return: The pointer to the object.

ccv_cache_delete

int ccv_cache_delete(ccv_cache_t *cache, uint64_t sign)

Delete an object from cache for its signature and free it.

return: -1 if cannot find the object, otherwise return 0.

ccv_cache_cleanup

void ccv_cache_cleanup(ccv_cache_t *cache)

Clean up the cache, free all objects inside and other memory space occupied.

ccv_cache_close

void ccv_cache_close(ccv_cache_t *cache)

For current implementation (trie-based LRU cache), it is an alias for ccv_cache_cleanup.

‹  back 

comments powered by Disqus