The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
memcached based cache. More...
#include <libmemcached/memcached.h>
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/value.h>
#include "../../rlm_cache.h"
#include "../../serialize.h"
Go to the source code of this file.
Data Structures | |
struct | rlm_cache_memcached_handle_t |
struct | rlm_cache_memcached_t |
Macros | |
#define | LOG_PREFIX "cache - memcached" |
Functions | |
static int | _mod_conn_free (rlm_cache_memcached_handle_t *mandle) |
Free a connection handle. More... | |
static cache_status_t | cache_entry_expire (UNUSED rlm_cache_config_t const *config, UNUSED void *instance, request_t *request, void *handle, fr_value_box_t const *key) |
Call delete the cache entry from memcached. More... | |
static cache_status_t | cache_entry_find (rlm_cache_entry_t **out, UNUSED rlm_cache_config_t const *config, UNUSED void *instance, request_t *request, void *handle, fr_value_box_t const *key) |
Locate a cache entry in memcached. More... | |
static void | cache_entry_free (rlm_cache_entry_t *c) |
Locate a cache entry in memcached. More... | |
static cache_status_t | cache_entry_insert (UNUSED rlm_cache_config_t const *config, UNUSED void *instance, request_t *request, void *handle, const rlm_cache_entry_t *c) |
Insert a new entry into the data store. More... | |
static void * | mod_conn_create (TALLOC_CTX *ctx, void *instance, fr_time_delta_t timeout) |
Create a new memcached handle. More... | |
static int | mod_conn_get (void **handle, UNUSED rlm_cache_config_t const *config, void *instance, request_t *request) |
Get a memcached handle. More... | |
static int | mod_conn_reconnect (void **handle, UNUSED rlm_cache_config_t const *config, void *instance, request_t *request) |
Reconnect a memcached handle. More... | |
static void | mod_conn_release (UNUSED rlm_cache_config_t const *config, void *instance, request_t *request, rlm_cache_handle_t *handle) |
Release a memcached handle. More... | |
static int | mod_instantiate (module_inst_ctx_t const *mctx) |
Create a new rlm_cache_memcached instance. More... | |
static int | mod_load (void) |
Variables | |
static const conf_parser_t | driver_config [] |
rlm_cache_driver_t | rlm_cache_memcached |
memcached based cache.
Definition in file rlm_cache_memcached.c.
struct rlm_cache_memcached_handle_t |
Definition at line 37 of file rlm_cache_memcached.c.
Data Fields | ||
---|---|---|
memcached_st * | handle |
struct rlm_cache_memcached_t |
Definition at line 41 of file rlm_cache_memcached.c.
Data Fields | ||
---|---|---|
char const * | options | Connection options. |
fr_pool_t * | pool |
#define LOG_PREFIX "cache - memcached" |
Definition at line 25 of file rlm_cache_memcached.c.
|
static |
Free a connection handle.
mandle | to free. |
Definition at line 55 of file rlm_cache_memcached.c.
|
static |
Call delete the cache entry from memcached.
[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. |
Definition at line 246 of file rlm_cache_memcached.c.
|
static |
Locate a cache entry in memcached.
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] | 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 |
Definition at line 159 of file rlm_cache_memcached.c.
|
static |
Locate a cache entry in memcached.
If the driver does not need to keep a local copy of the cache entry, it should provide a callback to free the memory previously allocated for the cache entry by cache_entry_find_t or by rlm_cache.
c | entry to free. |
Definition at line 150 of file rlm_cache_memcached.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. |
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. |
Definition at line 209 of file rlm_cache_memcached.c.
|
static |
Create a new memcached handle.
Definition at line 65 of file rlm_cache_memcached.c.
|
static |
Get a memcached handle.
[out] | handle | Where to write pointer to handle to access the cache with. |
[in] | config | for this instance of the rlm_cache module. |
[in] | instance | Driver specific instance data. |
[in] | request | The current request. |
Definition at line 271 of file rlm_cache_memcached.c.
|
static |
Reconnect a memcached handle.
[in,out] | handle | to reinitialise/reconnect. |
[in] | config | for this instance of the rlm_cache module. |
[in] | instance | Driver specific instance data. |
[in] | request | The current request. |
Definition at line 305 of file rlm_cache_memcached.c.
|
static |
Release a memcached handle.
[in] | config | for this instance of the rlm_cache module. |
[in] | instance | Driver specific instance data. |
[in] | request | The current request. |
[in] | handle | to release. |
Definition at line 293 of file rlm_cache_memcached.c.
|
static |
Create a new rlm_cache_memcached instance.
[in] | mctx | Data required for instantiation. |
Definition at line 108 of file rlm_cache_memcached.c.
|
static |
Definition at line 140 of file rlm_cache_memcached.c.
|
static |
Definition at line 46 of file rlm_cache_memcached.c.
rlm_cache_driver_t rlm_cache_memcached |
Definition at line 322 of file rlm_cache_memcached.c.