Skip to main content

Name

ec_cache_find — Find a cache item determined by a key

Synopsis

#include "ec_cache.h"

| ec_cache_elt * **ec_cache_find** ( | cache, |   | |   | key, |   | |   | keylen); |   |

ec_cache_t * <var class="pdparam">cache</var>; const char * <var class="pdparam">key</var>; int <var class="pdparam">keylen</var>;

Description

Find a cache item determined by a key. If the element is found, its reference count will be incremented and the element returned to you.

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;.

key

Identifies the entry in the cache. It will be copied into the “ec_cache_elt” structure.

keylen

The length of the key, in bytes.

Return Values

Returns the address of the “ec_cache_elt” structure associated with the key. Returns NULL if no corresponding value to key is found.

Note

You are responsible for calling ec_cache_delref on this structure when you are finished using it. This is to ensure that the cache doesn't cause it to be deleted and to ensure that allocated memory is released.

Threading

It is legal to call this function in any thread.

See Also

Was this page helpful?