clrucache · Section 3
clrucache_capacity
NAME
clrucache_capacity - return the maximum capacity of the cache
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/clrucache.h> size_t clrucache_capacity(ccache cache);
DESCRIPTION
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.
PARAMETERS
cache Cache handle.
RETURN VALUE
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.
NOTES
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).