diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-11-07 18:15:54 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-11-07 18:15:54 +0300 |
commit | c28181fe44aefc2c4e31b0d76c50c2793dcc1702 (patch) | |
tree | cf9af7ee130e205d85546b3a14913da40afb05bd /src/kvstorage_config.c | |
parent | d461b9f83ab8c2b6cc2a762f135e87687f51a8dd (diff) | |
download | rspamd-c28181fe44aefc2c4e31b0d76c50c2793dcc1702.tar.gz rspamd-c28181fe44aefc2c4e31b0d76c50c2793dcc1702.zip |
* Add judy storage for fast caching.
Fix LRU expiration.
Diffstat (limited to 'src/kvstorage_config.c')
-rw-r--r-- | src/kvstorage_config.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/kvstorage_config.c b/src/kvstorage_config.c index 57a23d6ab..8097078a4 100644 --- a/src/kvstorage_config.c +++ b/src/kvstorage_config.c @@ -31,7 +31,6 @@ #include "kvstorage_sqlite.h" #endif -#define LRU_QUEUES 32 /* Global hash of storages indexed by id */ GHashTable *storages = NULL; @@ -92,6 +91,14 @@ kvstorage_init_callback (const gpointer key, const gpointer value, gpointer unus case KVSTORAGE_TYPE_CACHE_RADIX: cache = rspamd_kv_radix_new (); break; +#ifdef WITH_JUDY + case KVSTORAGE_TYPE_CACHE_JUDY: + cache = rspamd_kv_judy_new (); + break; +#endif + default: + msg_err ("unknown cache type, internal error"); + return; } switch (kconf->backend.type) { @@ -113,7 +120,7 @@ kvstorage_init_callback (const gpointer key, const gpointer value, gpointer unus switch (kconf->expire.type) { case KVSTORAGE_TYPE_EXPIRE_LRU: - expire = rspamd_lru_expire_new (LRU_QUEUES); + expire = rspamd_lru_expire_new (); break; } @@ -360,6 +367,11 @@ void kvstorage_xml_text (GMarkupParseContext *context, else if (g_ascii_strncasecmp (text, "radix", MIN (text_len, sizeof ("radix") - 1)) == 0) { kv_parser->current_storage->cache.type = KVSTORAGE_TYPE_CACHE_RADIX; } +#ifdef WITH_JUDY + else if (g_ascii_strncasecmp (text, "judy", MIN (text_len, sizeof ("judy") - 1)) == 0) { + kv_parser->current_storage->cache.type = KVSTORAGE_TYPE_CACHE_JUDY; + } +#endif else { if (*error == NULL) { *error = g_error_new (xml_error_quark (), XML_EXTRA_ELEMENT, "invalid cache type: %*s", (int)text_len, text); |