C Collections

clrucache · Section 3

clrucache_capacity

clrucache_capacity - return the maximum capacity of the cache

C Collections (libccollections, -lccollections)

#include <ccollections/clrucache.h>
 
size_t clrucache_capacity(ccache cache);

Returns the maximum number of live entries that the cache can hold
before eviction starts, which is the capacity that the caller gave to
clrucache_create_full() at construction time.

cache  Cache handle.

The capacity, which is always >= 1 for a valid handle. It is 0 when
cache is CCACHE_NULL, and 0 when cache is a stale handle that a
call already destroyed.

cache is an opaque VALUE handle, which the library resolves through a
slot table of its own before it touches the cache object behind it. A
stale handle is an ordinary error here and not a fatal one; only
ccache_destroy() treats a stale handle as fatal.
The function takes no lock, because the capacity is fixed when the
cache is created and nothing writes it afterwards. It is the total
across the cache's segments, exactly the value that the caller gave to
the constructor.
The complexity is O(1).

clrucache_size(3), clrucache_create_full(3)