ec_cache_purge

March 26, 2020 Contributors

Name

ec_cache_purge — Explicitly remove elements from the cache

Synopsis

#include "ec_cache.h"

| int **ec_cache_purge** ( | cache, |   |
|   | now, |   |
|   | purge_all); |   |

ec_cache_t * <var class="pdparam">cache</var>;
time_t * <var class="pdparam">now</var>;
int <var class="pdparam">purge_all</var>;

Description

Allows you to explicitly remove elements from the cache. If the the cache was configured with a time-to-live for the elements, then the now will be interpreted as the effective current time and elements older than nowttl will be purged from the cache. If the purge_all is non-zero, then all elements will be purged from the cache.

Parameters

cache

The address of the cache. The following typedef applies to the ec_cache_t data type:

typedef struct ec_cache_head ec_cache_t;

now

Will be interpreted as the effective current time.

purge_all

If this parameter is non-zero, then all elements will be purged from the cache.

Return Values

This function returns the number of purged entries.

Threading

While it is legal to call this function in any thread, it should only be called in the Scheduler thread.

See Also

ec_cache_create, ec_cache_create2, ec_cache_delref, ec_cache_destroy, ec_cache_find, ec_cache_insert, “ec_cache_head”, and “ec_cache_elt”.