Skip to main content

Name

ec_fc_create — Returns a new cache with maximum number of entries and a default expiration time

Synopsis

#include "ec_fc.h"

| ec_fc_t * **ec_fc_create** ( | name, |   | |   | n_entries, |   | |   | expire, |   | |   | destroy_entry); |   |

char * <var class="pdparam">name</var>; size_t <var class="pdparam">n_entries</var>; unsigned int <var class="pdparam">expire</var>; ec_fc_entry_dtor <var class="pdparam">destroy_entry</var>;

Description

Note

This reference page was automatically generated from functions found in the header files in the development branch. The function described here may not exist in generally available versions of Momentum, and may change in behavior when it is generally available. Consult your vendor for definitive advice on the use of this function.

Returns a new cache with maximum number of entries and a default expiration time.

Creates a faster cache whose entries have a maximum TTL of expire unless expire is EC_FC_EXPIRE_NEVER. destroy_entry is the destructor for the object. Note, the caller should add a reference to the entry before adding an item unless it isn't important that the cache delete it during book-keeping. If name is NULL then a name is auto-generated based on the memory location of the new cache.

Parameters

name

name of the cache, if NULL, name is auto-generated

entries

number of entries in cache, rounded up to nearest power-of-two

expire

default expiration time in seconds of items in the cache

destroy_entry

destructor function for cache entries

Return Values

Returns a new cache instance.

Related Constants

EC_FC_EXPIRE_NEVER

No default expiration time.

Was this page helpful?