ec_cache_create — Create a cache with
ec_cache_t * **ec_cache_create** ( | max_elts, | |
| | max_lifetime, | |
| | dtor
); | |
Create a cache with
This is equivalent to calling
ec_cache_create2 with a NULL
The maximum number of elements that can be kept in the cache. If that number is exceeded, then the least recently used (LRU) element will be removed from the cache.
Specifies a time-to-live (TTL) in seconds for the cache element. If
max_lifetimeis not given the value
EC_CACHE_LIFETIME_INFINITE, then it specifies a time-to-live in seconds after which the entry will be removed from the cache. If using the cache in per-item-ttl mode, then
max_lifetimeis actually a number of additional seconds beyond the ttl for which an element will not be removed.
Specifies a function that will be called when the refcount of an item becomes zero. The following typedef applies to this data type:
typedef void (*ec_cache_elt_dtor_func)(void *value);.
Returns the address of an
ec_cache_t type. The following typedef applies to this data type:
typedef struct ec_cache_head ec_cache_t;.
While it is legal to call this function in any thread, it should only be called in the Scheduler thread.