redis based cache.
More...
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/value.h>
#include "../../rlm_cache.h"
#include <freeradius-devel/redis/base.h>
#include <freeradius-devel/redis/cluster.h>
Go to the source code of this file.
|
static cache_status_t | cache_entry_expire (UNUSED rlm_cache_config_t const *config, void *instance, request_t *request, UNUSED void *handle, fr_value_box_t const *key) |
| 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 *instance, request_t *request, UNUSED void *handle, fr_value_box_t const *key) |
| 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 *instance, request_t *request, UNUSED void *handle, const rlm_cache_entry_t *c) |
| Insert a new entry into the data store. More...
|
|
static int | mod_instantiate (module_inst_ctx_t const *mctx) |
| Create a new rlm_cache_redis instance. More...
|
|
static int | mod_load (void) |
|
redis based cache.
- Id
- d5ad02d98725df5611c7d6fdc5b7d7727500418b
- Copyright
- 2015 Arran Cudbard-Bell (a.cud.nosp@m.bard.nosp@m.b@fre.nosp@m.erad.nosp@m.ius.o.nosp@m.rg)
Definition in file rlm_cache_redis.c.
◆ rlm_cache_redis_t
◆ LOG_PREFIX
#define LOG_PREFIX "cache - redis" |
◆ cache_entry_expire()
Call delete the cache entry from redis.
- Note
- This callback is not optional.
- Parameters
-
[in] | config | for this instance of the rlm_cache module. |
[in] | instance | 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. |
- Returns
-
Definition at line 432 of file rlm_cache_redis.c.
◆ cache_entry_find()
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.
- Parameters
-
[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] | instance | 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 |
- Returns
-
Definition at line 123 of file rlm_cache_redis.c.
◆ cache_entry_free()
◆ cache_entry_insert()
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.
- Note
- This callback is not optional.
-
This callback must overwrite existing cache entries on insert.
- Parameters
-
config | for this instance of the rlm_cache module. |
instance | 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. |
- Returns
-
Definition at line 253 of file rlm_cache_redis.c.
◆ mod_instantiate()
Create a new rlm_cache_redis instance.
- Parameters
-
[in] | mctx | Data required for instantiation. |
- Returns
- 0 on success.
- -1 on failure.
Definition at line 73 of file rlm_cache_redis.c.
◆ mod_load()
static int mod_load |
( |
void |
| ) |
|
|
static |
◆ attr_cache_created
◆ attr_cache_expires
◆ dict_freeradius
◆ driver_config
Initial value:= {
}
#define CONF_PARSER_TERMINATOR
#define REDIS_COMMON_CONFIG
Definition at line 33 of file rlm_cache_redis.c.
◆ rlm_cache_redis
Initial value:= {
.common = {
.name = "cache_redis",
},
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
static const conf_parser_t config[]
static cache_status_t cache_entry_insert(UNUSED rlm_cache_config_t const *config, void *instance, request_t *request, UNUSED void *handle, const rlm_cache_entry_t *c)
Insert a new entry into the data store.
static int mod_load(void)
static void cache_entry_free(rlm_cache_entry_t *c)
static conf_parser_t driver_config[]
static cache_status_t cache_entry_expire(UNUSED rlm_cache_config_t const *config, void *instance, request_t *request, UNUSED void *handle, fr_value_box_t const *key)
Call delete the cache entry from redis.
static cache_status_t cache_entry_find(rlm_cache_entry_t **out, UNUSED rlm_cache_config_t const *config, void *instance, request_t *request, UNUSED void *handle, fr_value_box_t const *key)
Locate a cache entry in redis.
static int mod_instantiate(module_inst_ctx_t const *mctx)
Create a new rlm_cache_redis instance.
Definition at line 473 of file rlm_cache_redis.c.
◆ rlm_cache_redis_dict
Initial value:= {
{ NULL }
}
static fr_dict_t const * dict_freeradius
Definition at line 51 of file rlm_cache_redis.c.
◆ rlm_cache_redis_dict_attr
Initial value:= {
{ NULL }
}
@ FR_TYPE_DATE
Unix time stamp, always has value >2^31.
static fr_dict_attr_t const * attr_cache_created
static fr_dict_attr_t const * attr_cache_expires
Definition at line 60 of file rlm_cache_redis.c.