clrucache · Section 3
ccache_init
NAME
ccache_init - initialise a previously declared LRU cache variable
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/clrucache.h> ccache_init(name, capacity, getter, setter, evict_cb);
DESCRIPTION
Calls clrucache_create_full() and assigns the result to name, with the key type and the value type taken from the companion variables that ccache_declare() created. It calls ccol__fatal_err() when the creation fails.
PARAMETERS
name Cache variable. Declare it with ccache_declare or
ccache_declare_scoped first
capacity The total number of live entries; see
clrucache_create_full(3). It must be greater than 0
getter Remote getter callback, or NULL
setter Remote setter callback, or NULL
evict_cb Eviction callback, or NULL
NOTES
The macro calls ccol__fatal_err() when an allocation fails, so call clrucache_create_full() directly when you must handle an error yourself.
EXAMPLES
ccache_declare(cache, int, double); ccache_init(cache, 64, NULL, NULL, NULL); ccache_destroy(cache);
SEE ALSO
ccache_declare(3), ccache_construct(3), clrucache_create_full(3)