ec_cache Functions

March 26, 2020 Contributors
Name Description
ec_cache_create Create a cache with max_elts
ec_cache_create2 Create a cache with max_elts
ec_cache_delete Delete an item determined by key from a cache
ec_cache_delref Delete a reference from a cached item determined by elt in a cache
ec_cache_destroy Purge all entries from the cache and free all memory allocated to it
ec_cache_find Find a cache item determined by a key
ec_cache_get_stats Get cache statistics (deprecated)
ec_cache_get_stats2 get cache statistics
ec_cache_get_stats_by_name get cache statistics for a named cache
ec_cache_insert Insert a key/value pair into a cache
ec_cache_purge Explicitly remove elements from the cache
ec_cache_resolve Look up an element from the cache
ec_cache_resolver_delref Release a resolver object reference
ec_cache_resolver_run_on_completion Schedule a function to run when the resolver completes
ec_cache_resolver_set_complete Stores the resolved cache element in the resolver
ec_cache_resolver_wait_for_completion Blocks the caller until cache resolution completes
ec_cache_resolver_wake_on_completion Allows a thread to block, pending completion of the cache resolution

A common requirement for high performance modules is to cache information that is expensive to obtain. The generic cache implementation in Momentum operates by having an upper bound on the number of elements to be stored in a cache, pushing out the least recently used item when an insert is made and the cache is full. You may optionally set a time-to-live for the cache; elements that have been stored in the cache for longer than the time-to-live will, periodically, be expired from the cache.

The APIs documented here relate to the cache list console command.