diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-11 15:16:09 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-11 15:16:09 +0000 |
commit | 361fb11df8192802c73561c72e69adf5831d042a (patch) | |
tree | 6bab5b43f5cbc4a51efceb46dc9f760abf1f02f0 /src/libstat/learn_cache/redis_cache.c | |
parent | 48012e1b39ce064553a4112afa5679b4894b79ad (diff) | |
download | rspamd-361fb11df8192802c73561c72e69adf5831d042a.tar.gz rspamd-361fb11df8192802c73561c72e69adf5831d042a.zip |
Enable per-users learn cache
Diffstat (limited to 'src/libstat/learn_cache/redis_cache.c')
-rw-r--r-- | src/libstat/learn_cache/redis_cache.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libstat/learn_cache/redis_cache.c b/src/libstat/learn_cache/redis_cache.c index c1dd89fc4..424748039 100644 --- a/src/libstat/learn_cache/redis_cache.c +++ b/src/libstat/learn_cache/redis_cache.c @@ -160,9 +160,16 @@ rspamd_stat_cache_redis_generate_id (struct rspamd_task *task) guint i; guchar out[rspamd_cryptobox_HASHBYTES]; gchar *b32out; + gchar *user = NULL; rspamd_cryptobox_hash_init (&st, NULL, 0); + user = rspamd_mempool_get_variable (task->task_pool, "stat_user"); + /* Use dedicated hash space for per users cache */ + if (user != NULL) { + rspamd_cryptobox_hash_update (&st, user, strlen (user)); + } + for (i = 0; i < task->tokens->len; i ++) { tok = g_ptr_array_index (task->tokens, i); rspamd_cryptobox_hash_update (&st, tok->data, tok->datalen); |