Cache values and merge them back into future requests. More...
#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/modules.h>
#include <freeradius-devel/modpriv.h>
#include <freeradius-devel/modcall.h>
#include <freeradius-devel/rad_assert.h>
#include "rlm_cache.h"
Go to the source code of this file.
Functions | |
static int | cache_acquire (rlm_cache_handle_t **out, rlm_cache_t const *inst, REQUEST *request) |
Get exclusive use of a handle to access the cache. More... | |
static rlm_cache_entry_t * | cache_alloc (rlm_cache_t const *inst, REQUEST *request) |
Allocate a cache entry. More... | |
static rlm_rcode_t | cache_expire (rlm_cache_t const *inst, REQUEST *request, rlm_cache_handle_t **handle, uint8_t const *key, size_t key_len) |
Expire a cache entry (removing it from the datastore) More... | |
static rlm_rcode_t | cache_find (rlm_cache_entry_t **out, rlm_cache_t const *inst, REQUEST *request, rlm_cache_handle_t **handle, uint8_t const *key, size_t key_len) |
Find a cached entry. More... | |
static void | cache_free (rlm_cache_t const *inst, rlm_cache_entry_t **c) |
Free memory associated with a cache entry. More... | |
static rlm_rcode_t | cache_insert (rlm_cache_t const *inst, REQUEST *request, rlm_cache_handle_t **handle, uint8_t const *key, size_t key_len, int ttl) |
Create and insert a cache entry. More... | |
static rlm_rcode_t | cache_merge (rlm_cache_t const *inst, REQUEST *request, rlm_cache_entry_t *c) CC_HINT(nonnull) |
Merge a cached entry into a REQUEST. More... | |
static int | cache_reconnect (rlm_cache_handle_t **handle, rlm_cache_t const *inst, REQUEST *request) |
Reconnect an suspected inviable handle. More... | |
static void | cache_release (rlm_cache_t const *inst, REQUEST *request, rlm_cache_handle_t **handle) |
Release a handle we previously acquired. More... | |
static rlm_rcode_t | cache_set_ttl (rlm_cache_t const *inst, REQUEST *request, rlm_cache_handle_t **handle, rlm_cache_entry_t *c) |
Update the TTL of an entry. More... | |
static int | cache_verify (vp_map_t *map, void *ctx) |
Verify that a map in the cache section makes sense. More... | |
static ssize_t | cache_xlat (char **out, UNUSED size_t freespace, void const *mod_inst, UNUSED void const *xlat_inst, REQUEST *request, char const *fmt) CC_HINT(nonnull) |
Allow single attribute values to be retrieved from the cache. More... | |
static int | mod_bootstrap (CONF_SECTION *conf, void *instance) |
Register module xlats. More... | |
static rlm_rcode_t | mod_cache_it (void *instance, REQUEST *request) CC_HINT(nonnull) |
Do caching checks. More... | |
static int | mod_detach (void *instance) |
Free any memory allocated under the instance. More... | |
static int | mod_instantiate (CONF_SECTION *conf, void *instance) |
Create a new rlm_cache_instance. More... | |
Variables | |
static const CONF_PARSER | module_config [] |
module_t | rlm_cache |
Cache values and merge them back into future requests.
Definition in file rlm_cache.c.
|
static |
Get exclusive use of a handle to access the cache.
Definition at line 58 of file rlm_cache.c.
|
static |
Allocate a cache entry.
This is used so that drivers may use their own allocation functions to allocate structures larger than the normal rlm_cache_entry_t.
If the driver doesn't specify a custom allocation function, the cache entry is talloced in the NULL ctx.
Definition at line 95 of file rlm_cache.c.
|
static |
Expire a cache entry (removing it from the datastore)
Definition at line 261 of file rlm_cache.c.
|
static |
Find a cached entry.
Definition at line 182 of file rlm_cache.c.
|
static |
Free memory associated with a cache entry.
This does not necessarily remove the entry from the cache, cache_expire should be used for that.
This function should be called when an entry that is known to have been retrieved or inserted into a data store successfully, is no longer needed.
Some drivers (like rlm_cache_rbtree) don't register a free function. This means that the cache entry never needs to be explicitly freed.
[in] | inst | Module instance. |
[in,out] | c | Cache entry to free. |
Definition at line 116 of file rlm_cache.c.
|
static |
Create and insert a cache entry.
Definition at line 289 of file rlm_cache.c.
|
static |
Merge a cached entry into a REQUEST.
Definition at line 131 of file rlm_cache.c.
|
static |
Reconnect an suspected inviable handle.
Definition at line 80 of file rlm_cache.c.
|
static |
Release a handle we previously acquired.
Definition at line 68 of file rlm_cache.c.
|
static |
Update the TTL of an entry.
Definition at line 472 of file rlm_cache.c.
|
static |
Verify that a map in the cache section makes sense.
Definition at line 522 of file rlm_cache.c.
|
static |
Allow single attribute values to be retrieved from the cache.
Definition at line 783 of file rlm_cache.c.
|
static |
Register module xlats.
Definition at line 877 of file rlm_cache.c.
|
static |
Do caching checks.
Since we can update ANY VP list, we do exactly the same thing for all sections (autz / auth / etc.)
If you want to cache something different in different sections, configure another cache module.
Definition at line 544 of file rlm_cache.c.
|
static |
Free any memory allocated under the instance.
Definition at line 849 of file rlm_cache.c.
|
static |
Create a new rlm_cache_instance.
Definition at line 897 of file rlm_cache.c.
|
static |
Definition at line 43 of file rlm_cache.c.
module_t rlm_cache |
Definition at line 1012 of file rlm_cache.c.