redis based cache. More...
#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/rad_assert.h>
#include "../../rlm_cache.h"
#include "../../../rlm_redis/redis.h"
#include "../../../rlm_redis/cluster.h"
Go to the source code of this file.
Data Structures | |
struct | rlm_cache_redis |
Typedefs | |
typedef struct rlm_cache_redis | rlm_cache_redis_t |
Functions | |
static cache_status_t | cache_entry_expire (UNUSED rlm_cache_config_t const *config, void *driver_inst, REQUEST *request, UNUSED void *handle, uint8_t const *key, size_t key_len) |
Call delete the cache entry from redis. More... | |
static cache_status_t | cache_entry_find (rlm_cache_entry_t **out, UNUSED rlm_cache_config_t const *config, void *driver_inst, REQUEST *request, UNUSED void *handle, uint8_t const *key, size_t key_len) |
Locate a cache entry in redis. More... | |
static void | cache_entry_free (rlm_cache_entry_t *c) |
static cache_status_t | cache_entry_insert (UNUSED rlm_cache_config_t const *config, void *driver_inst, REQUEST *request, UNUSED void *handle, const rlm_cache_entry_t *c) |
Insert a new entry into the data store. More... | |
static int | mod_instantiate (CONF_SECTION *conf, rlm_cache_config_t const *config, void *driver_inst) |
Create a new rlm_cache_redis instance. More... | |
Variables | |
static CONF_PARSER | driver_config [] |
cache_driver_t | rlm_cache_redis |
redis based cache.
Definition in file rlm_cache_redis.c.
struct rlm_cache_redis |
Definition at line 36 of file rlm_cache_redis.c.
Data Fields | ||
---|---|---|
fr_redis_cluster_t * | cluster | |
fr_redis_conf_t | conf |
Connection parameters for the Redis server. Must be first field in this struct. |
vp_tmpl_t | created_attr | LHS of the Cache-Created map. |
vp_tmpl_t | expires_attr | LHS of the Cache-Expires map. |
typedef struct rlm_cache_redis rlm_cache_redis_t |
|
static |
Call delete the cache entry from redis.
[in] | config | for this instance of the rlm_cache module. |
[in] | driver_inst | Driver specific instance data. |
[in] | request | The current request. |
[in] | handle | the driver gave us when we called cache_acquire_t, or NULL if no cache_acquire_t callback was provided. |
[in] | key | of entry to expire. |
[in] | key_len | the length of the key string. |
Definition at line 415 of file rlm_cache_redis.c.
|
static |
Locate a cache entry in redis.
If a cache entry is found, but the cache entry needs to be deserialized, the driver is expected to allocate an appropriately sized rlm_cache_entry_t, perform the deserialisation, and write a pointer to the new entry to out, returning CACHE_OK.
If the rlm_cache_handle_t is inviable, the driver should return CACHE_RECONNECT, to have it reinitialised/reconnected.
[out] | out | Where to write a pointer to the retrieved entry (if there was one). |
[in] | config | for this instance of the rlm_cache module. |
[in] | driver_inst | Driver specific instance data. |
[in] | request | The current request. |
[in] | handle | the driver gave us when we called cache_acquire_t, or NULL if no cache_acquire_t callback was provided. |
[in] | key | to use to lookup cache entry |
[in] | key_len | the length of the key string. |
Definition at line 96 of file rlm_cache_redis.c.
|
static |
Definition at line 87 of file rlm_cache_redis.c.
|
static |
Insert a new entry into the data store.
Serialize (if necessary) the entry passed to us, and write it to the cache with the key c->key.
The cache entry should not be freed by the driver, irrespective of success or failure. If the entry needs to be freed after insertion because a local copy should not be kept, the driver should provide a cache_entry_free_t callback.
If the rlm_cache_handle_t is inviable, the driver should return CACHE_RECONNECT, to have it reinitialised/reconnected.
config | for this instance of the rlm_cache module. |
driver_inst | Driver specific instance data. |
request | The current request. |
handle | the driver gave us when we called cache_acquire_t, or NULL if no cache_acquire_t callback was provided. |
c | to insert. |
Definition at line 233 of file rlm_cache_redis.c.
|
static |
Create a new rlm_cache_redis instance.
Function to handle any driver specific instantiation.
conf | section holding driver specific CONF_PAIR (s). |
config | of the rlm_cache module. Should not be modified. |
driver_inst | A uint8_t array of inst_size if inst_size > 0, else NULL. Drivers should add their own cleanup function to this chunk using talloc_set_destructor. |
Definition at line 50 of file rlm_cache_redis.c.
|
static |
Definition at line 31 of file rlm_cache_redis.c.
Definition at line 452 of file rlm_cache_redis.c.