From c1c8dba96ef13bfc8725a5142d751601c48c6719 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 8 Apr 2016 22:04:36 +0100 Subject: [Feature] Use heap in LRU caches Signed-off-by: Vsevolod Stakhov --- src/plugins/dkim_check.c | 12 ++---------- src/plugins/spf.c | 21 ++------------------- 2 files changed, 4 insertions(+), 29 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c index 7852ddd6c..ee62eb50e 100644 --- a/src/plugins/dkim_check.c +++ b/src/plugins/dkim_check.c @@ -222,7 +222,7 @@ dkim_module_config (struct rspamd_config *cfg) const ucl_object_t *value; const gchar *str; gint res = TRUE, cb_id; - guint cache_size, cache_expire; + guint cache_size; gboolean got_trusted = FALSE; if (!rspamd_config_is_module_enabled (cfg, "dkim")) { @@ -261,14 +261,7 @@ dkim_module_config (struct rspamd_config *cfg) else { cache_size = DEFAULT_CACHE_SIZE; } - if ((value = - rspamd_config_get_module_opt (cfg, "dkim", - "dkim_cache_expire")) != NULL) { - cache_expire = ucl_obj_todouble (value); - } - else { - cache_expire = DEFAULT_CACHE_MAXAGE; - } + if ((value = rspamd_config_get_module_opt (cfg, "dkim", "time_jitter")) != NULL) { dkim_module_ctx->time_jitter = ucl_obj_todouble (value); @@ -364,7 +357,6 @@ dkim_module_config (struct rspamd_config *cfg) dkim_module_ctx->dkim_hash = rspamd_lru_hash_new ( cache_size, - cache_expire, g_free, /* Keys are just C-strings */ dkim_module_key_dtor); diff --git a/src/plugins/spf.c b/src/plugins/spf.c index edad4bfc9..a71958b4c 100644 --- a/src/plugins/spf.c +++ b/src/plugins/spf.c @@ -153,15 +153,6 @@ spf_module_init (struct rspamd_config *cfg, struct module_ctx **ctx) 0, NULL, 0); - rspamd_rcl_add_doc_by_path (cfg, - "spf", - "Maximum lifetime for the elements in the SPF cache", - "spf_cache_expire", - UCL_TIME, - NULL, - 0, - NULL, - 0); return 0; } @@ -172,7 +163,7 @@ spf_module_config (struct rspamd_config *cfg) { const ucl_object_t *value; gint res = TRUE, cb_id; - guint cache_size, cache_expire; + guint cache_size; const gchar *str; if (!rspamd_config_is_module_enabled (cfg, "spf")) { @@ -216,14 +207,7 @@ spf_module_config (struct rspamd_config *cfg) else { cache_size = DEFAULT_CACHE_SIZE; } - if ((value = - rspamd_config_get_module_opt (cfg, "spf", - "spf_cache_expire")) != NULL) { - cache_expire = ucl_obj_toint (value); - } - else { - cache_expire = DEFAULT_CACHE_MAXAGE; - } + if ((value = rspamd_config_get_module_opt (cfg, "spf", "whitelist")) != NULL) { @@ -265,7 +249,6 @@ spf_module_config (struct rspamd_config *cfg) spf_module_ctx->spf_hash = rspamd_lru_hash_new ( cache_size, - cache_expire, NULL, (GDestroyNotify)spf_record_unref); -- cgit v1.2.3