cache_get

March 26, 2020 Contributors

Name

cache_get

Synopsis

#include "hooks/core/cache_get.h"

| int **cache_get** ( | closure, |   |
|   | name, |   |
|   | key, |   |
|   | klen, |   |
|   | value, |   |
|   | vlen); |   |

void * <var class="pdparam">closure</var>;
const char * <var class="pdparam">name</var>;
const void * <var class="pdparam">key</var>;
int <var class="pdparam">klen</var>;
void ** <var class="pdparam">value</var>;
int * <var class="pdparam">vlen</var>;

| int **has_core_cache_get_hook** ( | ); |   |

| void **register_core_cache_get_hook_first** ( | hook, |   |
|   | closure); |   |

ec_hook_core_cache_get_func_t <var class="pdparam">hook</var>;
void *<var class="pdparam">closure</var>;

| void **register_core_cache_get_hook_last** ( | hook, |   |
|   | closure); |   |

ec_hook_core_cache_get_func_t <var class="pdparam">hook</var>;
void *<var class="pdparam">closure</var>;

| int **call_core_cache_get_hook** ( | name, |   |
|   | key, |   |
|   | klen, |   |
|   | value, |   |
|   | vlen); |   |

const char * <var class="pdparam">name</var>;
const void * <var class="pdparam">key</var>;
int <var class="pdparam">klen</var>;
void ** <var class="pdparam">value</var>;
int * <var class="pdparam">vlen</var>;

Description

Momentum exposes the cache_get hook as a stub for generic, process-wide caching. cache_get will return zero (miss) or non-zero (hit) if the specficied key of length klen exists in the cache named name. If it is a cache hit, *value and *vlen will be set to reflect the value at that key.