diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-10 22:34:19 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-10 22:34:19 +0000 |
commit | d0a92eca7e992d1c1b544c24d09acf0019babaa3 (patch) | |
tree | af5d420ce0da1265062be66a32148b608612a8c0 /src/libstat/stat_config.c | |
parent | 5a4566af6e715e15ea8dce6776cdc7b9bd03b5bf (diff) | |
download | rspamd-d0a92eca7e992d1c1b544c24d09acf0019babaa3.tar.gz rspamd-d0a92eca7e992d1c1b544c24d09acf0019babaa3.zip |
Rework caches API
Diffstat (limited to 'src/libstat/stat_config.c')
-rw-r--r-- | src/libstat/stat_config.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/libstat/stat_config.c b/src/libstat/stat_config.c index 1c6989508..d8b980aec 100644 --- a/src/libstat/stat_config.c +++ b/src/libstat/stat_config.c @@ -77,13 +77,20 @@ static struct rspamd_stat_backend stat_backends[] = { #endif }; -static struct rspamd_stat_cache stat_caches[] = { - { - .name = RSPAMD_DEFAULT_CACHE, - .init = rspamd_stat_cache_sqlite3_init, - .process = rspamd_stat_cache_sqlite3_process, - .close = rspamd_stat_cache_sqlite3_close +#define RSPAMD_STAT_CACHE_ELT(nam, eltn) { \ + .name = #nam, \ + .init = rspamd_stat_cache_##eltn##_init, \ + .runtime = rspamd_stat_cache_##eltn##_runtime, \ + .check = rspamd_stat_cache_##eltn##_check, \ + .learn = rspamd_stat_cache_##eltn##_learn, \ + .close = rspamd_stat_cache_##eltn##_close \ } + +static struct rspamd_stat_cache stat_caches[] = { + RSPAMD_STAT_CACHE_ELT(sqlite3, sqlite3), +#ifdef WITH_HIREDIS + RSPAMD_STAT_CACHE_ELT(redis, redis), +#endif }; void |