#include <math.h>
#define RSPAMD_NORMALIZED_DIM 64
-#define RSPAMD_IMAGES_CACHE_SIZE 256
static rspamd_lru_hash_t *images_hash = NULL;
#endif
static void
rspamd_image_create_cache (struct rspamd_config *cfg)
{
- images_hash = rspamd_lru_hash_new_full (RSPAMD_IMAGES_CACHE_SIZE, NULL,
+ images_hash = rspamd_lru_hash_new_full (cfg->images_cache_size, NULL,
rspamd_image_cache_entry_dtor,
rspamd_image_dct_hash, rspamd_image_dct_equal);
}
gchar *cores_dir; /**< directory for core files */
gsize max_message; /**< maximum size for messages */
gsize max_pic_size; /**< maximum size for a picture to process */
+ gsize images_cache_size; /**< size of LRU cache for DCT data from images */
enum rspamd_log_type log_type; /**< log type */
gint log_facility; /**< log facility in case of syslog */
G_STRUCT_OFFSET (struct rspamd_config, max_pic_size),
RSPAMD_CL_FLAG_INT_SIZE,
"Maximum size of the picture to be normalized (1Mb by default)");
+ rspamd_rcl_add_default_handler (sub,
+ "images_cache",
+ rspamd_rcl_parse_struct_integer,
+ G_STRUCT_OFFSET (struct rspamd_config, max_pic_size),
+ RSPAMD_CL_FLAG_INT_SIZE,
+ "Size of DCT data cache for images (256 elements by default)");
rspamd_rcl_add_default_handler (sub,
"zstd_input_dictionary",
rspamd_rcl_parse_struct_string,
cfg->ssl_ciphers = "HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4";
cfg->max_message = DEFAULT_MAX_MESSAGE;
cfg->max_pic_size = DEFAULT_MAX_PIC;
+ cfg->images_cache_size = 256;
cfg->monitored_ctx = rspamd_monitored_ctx_init ();
#ifdef WITH_HIREDIS
cfg->redis_pool = rspamd_redis_pool_init ();