Commit 4d6e2de4 authored by Marek Vavruša's avatar Marek Vavruša Committed by Marek Vavruša

modules/kmemcached: missing documentation, doc cleanup

parent d7ddee57
......@@ -14,3 +14,4 @@ Implemented modules
.. include:: ../modules/cachectl/README.rst
.. include:: ../modules/graphite/README.rst
.. include:: ../modules/ketcd/README.rst
.. include:: ../modules/kmemcached/README.rst
......@@ -64,9 +64,9 @@ struct kr_cache_txn {
* Open/create cache with provided storage options.
* @param cache cache structure to be initialized
* @param api Storage engine
* @param storage_opts Storage-specific options (may be NULL for default)
* @param mm Memory context.
* @param api storage engine API
* @param opts storage-specific options (may be NULL for default)
* @param mm memory context.
* @return 0 or an error code
int kr_cache_open(struct kr_cache *cache, const namedb_api_t *api, void *opts, mm_ctx_t *mm);
......@@ -97,7 +97,7 @@ struct lru_hash_base {
char slots[];
/** @breif User-defined hashtable. */
/** @brief User-defined hashtable. */
#define lru_hash(type) \
struct { \
lru_hash_struct \
......@@ -155,9 +155,9 @@ static inline void *lru_slot_set(struct lru_hash_base *lru, const char *key, uin
* @param table hash table
* @param max_slots number of slots
#define lru_init(table, max_size) \
(memset((table), 0, sizeof(*table) + (max_size) * sizeof((table)->slots[0])), \
(table)->stride = sizeof((table)->slots[0]), (table)->size = (max_size))
#define lru_init(table, max_slots) \
(memset((table), 0, sizeof(*table) + (max_slots) * sizeof((table)->slots[0])), \
(table)->stride = sizeof((table)->slots[0]), (table)->size = (max_slots))
* @brief Free all keys and evict all values.
Memcached cache storage
Module providing a cache storage backend for memcached_, which makes a good fit for
making a shared cache between resolvers.
After loading you can see the storage backend registered and useable.
.. code-block:: lua
> modules.load 'kmemcached'
> cache.backends()
[memcached://] => true
And you can use it right away, see the `libmemcached configuration`_ reference for configuration string
options, the most essential ones are `--SERVER` or `--SOCKET`. Here's an example for connecting to UNIX socket.
.. code-block:: lua
> = 'memcached://--SOCKET="/var/sock/memcached"'
.. note:: The memcached_ instance **MUST** support binary protocol, in order to make it work with binary keys. You can pass other options to the configuration string for performance tuning.
.. warning:: The memcached_ server is responsible for evicting entries out of cache, the pruning function is not implemented, and neither is aborting write transactions.
Build resolver shared cache
The memcached_ takes care of the data replication and fail over, you can add multiple servers at once.
.. code-block:: lua
> = 'memcached://--SOCKET="/var/sock/memcached" --SERVER= --SERVER=cache2.domain'
Depends on the libmemcached_ library.
.. _memcached:
.. _libmemcached:
.. _`libmemcached configuration`:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment