![]() |
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/slab.h>#include <freeradius-devel/util/value.h>#include "../../rlm_cache.h"#include "../../serialize.h"
Include dependency graph for rlm_cache_memcached.c:Go to the source code of this file.
Data Structures | |
| struct | rlm_cache_memcached_handle_t |
| struct | rlm_cache_memcached_t |
| struct | rlm_cache_memcached_thread_t |
Macros | |
| #define | LOG_PREFIX "cache - memcached" |
Functions | |
| static int | _mod_conn_free (rlm_cache_memcached_handle_t *mandle) |
| Free a connection handle. | |
| 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. | |
| 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. | |
| static void | cache_entry_free (rlm_cache_entry_t *c) |
| Locate a cache entry in memcached. | |
| 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. | |
| static int | memcached_conn_init (rlm_cache_memcached_handle_t *mandle, void *uctx) |
| Create a new memcached handle. | |
| static int | mod_conn_get (void **handle, UNUSED rlm_cache_config_t const *config, void *instance, UNUSED request_t *request) |
| Get a memcached handle. | |
| static int | mod_conn_reconnect (void **handle, UNUSED rlm_cache_config_t const *config, void *instance, UNUSED request_t *request) |
| Reconnect a memcached handle. | |
| static void | mod_conn_release (UNUSED rlm_cache_config_t const *config, UNUSED void *instance, UNUSED request_t *request, rlm_cache_handle_t *handle) |
| Release a memcached handle. | |
| static int | mod_instantiate (module_inst_ctx_t const *mctx) |
| Create a new rlm_cache_memcached instance. | |
| static int | mod_load (void) |
| static int | mod_thread_detach (module_thread_inst_ctx_t const *mctx) |
| static int | mod_thread_instantiate (module_thread_inst_ctx_t const *mctx) |
Variables | |
| static const conf_parser_t | driver_config [] |
| static conf_parser_t | reuse_memcached_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 38 of file rlm_cache_memcached.c.
| Data Fields | ||
|---|---|---|
| memcached_st * | handle | |
| struct rlm_cache_memcached_t |
Definition at line 45 of file rlm_cache_memcached.c.
Collaboration diagram for rlm_cache_memcached_t:| Data Fields | ||
|---|---|---|
| module_instance_t const * | mi | |
| char const * | options | Connection options. |
| fr_slab_config_t | reuse | |
| fr_time_delta_t | timeout | |
| struct rlm_cache_memcached_thread_t |
Definition at line 52 of file rlm_cache_memcached.c.
Collaboration diagram for rlm_cache_memcached_thread_t:| Data Fields | ||
|---|---|---|
| rlm_cache_memcached_t const * | inst | |
| memcached_slab_list_t * | slab | |
| #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 73 of file rlm_cache_memcached.c.
Here is the caller graph for this function:
|
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 252 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 164 of file rlm_cache_memcached.c.
Here is the call graph for this function:
|
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 155 of file rlm_cache_memcached.c.
Here is the call graph for this function:
|
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 215 of file rlm_cache_memcached.c.
Here is the call graph for this function:
|
static |
Create a new memcached handle.
Definition at line 83 of file rlm_cache_memcached.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
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 277 of file rlm_cache_memcached.c.
Here is the call graph for this function:
|
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 308 of file rlm_cache_memcached.c.
Here is the call graph for this function:
|
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 298 of file rlm_cache_memcached.c.
|
static |
Create a new rlm_cache_memcached instance.
| [in] | mctx | Data required for instantiation. |
Definition at line 122 of file rlm_cache_memcached.c.
|
static |
Definition at line 145 of file rlm_cache_memcached.c.
|
static |
|
static |
|
static |
Definition at line 62 of file rlm_cache_memcached.c.
|
static |
Definition at line 57 of file rlm_cache_memcached.c.
| rlm_cache_driver_t rlm_cache_memcached |
Definition at line 349 of file rlm_cache_memcached.c.
1.9.8