From: Vsevolod Stakhov Date: Thu, 7 Jan 2016 23:54:09 +0000 (+0000) Subject: Add conditions for using redis stat backend X-Git-Tag: 1.1.0~103 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a32a55dbfe8e7774e3d4fe3a2235f093eccdf194;p=rspamd.git Add conditions for using redis stat backend --- diff --git a/src/libstat/backends/backends.h b/src/libstat/backends/backends.h index 148ab4fe8..1f0ebc1be 100644 --- a/src/libstat/backends/backends.h +++ b/src/libstat/backends/backends.h @@ -106,6 +106,8 @@ struct rspamd_stat_backend { RSPAMD_STAT_BACKEND_DEF(mmaped_file); RSPAMD_STAT_BACKEND_DEF(sqlite3); +#ifdef WITH_HIREDIS RSPAMD_STAT_BACKEND_DEF(redis); +#endif #endif /* BACKENDS_H_ */ diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index 7a3d59e2e..2eb036841 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -29,7 +29,7 @@ #ifdef WITH_HIREDIS #include "hiredis/hiredis.h" #include "hiredis/adapters/libevent.h" -#endif + #define REDIS_CTX(p) (struct redis_stat_ctx *)(p) #define REDIS_RUNTIME(p) (struct redis_stat_runtime *)(p) @@ -704,3 +704,6 @@ rspamd_redis_load_tokenizer_config (gpointer runtime, return NULL; } + + +#endif diff --git a/src/libstat/stat_config.c b/src/libstat/stat_config.c index e3943b6e0..319eebaeb 100644 --- a/src/libstat/stat_config.c +++ b/src/libstat/stat_config.c @@ -72,7 +72,9 @@ static struct rspamd_stat_tokenizer stat_tokenizers[] = { static struct rspamd_stat_backend stat_backends[] = { RSPAMD_STAT_BACKEND_ELT(mmap, mmaped_file), RSPAMD_STAT_BACKEND_ELT(sqlite3, sqlite3), +#ifdef WITH_HIREDIS RSPAMD_STAT_BACKEND_ELT(redis, redis) +#endif }; static struct rspamd_stat_cache stat_caches[] = {