From df9d004cf838ec3e7e8f26d8255ffb78665c1c59 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 13 Jun 2013 13:47:09 +0200 Subject: Set TTL for attachments stored in sql database --- plugins/redundant_attachments/config.inc.php.dist | 6 +++--- plugins/redundant_attachments/redundant_attachments.php | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/redundant_attachments/config.inc.php.dist b/plugins/redundant_attachments/config.inc.php.dist index 6c317ead1..a0be3755e 100644 --- a/plugins/redundant_attachments/config.inc.php.dist +++ b/plugins/redundant_attachments/config.inc.php.dist @@ -6,8 +6,8 @@ // to use memcache as a fallback when write-master is unavailable. $rcmail_config['redundant_attachments_memcache'] = false; -// When memcache is used, attachment data expires after -// specied TTL time in seconds (max.2592000). Default is 12 hours. -$rcmail_config['redundant_attachments_memcache_ttl'] = 12 * 60 * 60; +// Attachment data expires after specied TTL time in seconds (max.2592000). +// Default is 12 hours. +$rcmail_config['redundant_attachments_cache_ttl'] = 12 * 60 * 60; ?> diff --git a/plugins/redundant_attachments/redundant_attachments.php b/plugins/redundant_attachments/redundant_attachments.php index 4ebc8dad7..c0affad3c 100644 --- a/plugins/redundant_attachments/redundant_attachments.php +++ b/plugins/redundant_attachments/redundant_attachments.php @@ -68,13 +68,14 @@ class redundant_attachments extends filesystem_attachments // load configuration $this->load_config(); + $ttl = 12 * 60 * 60; // 12 hours + $ttl = $rcmail->config->get('redundant_attachments_cache_ttl', $ttl); + // Init SQL cache (disable cache data serialization) - $this->cache = $rcmail->get_cache($this->prefix, 'db', 0, false); + $this->cache = $rcmail->get_cache($this->prefix, 'db', $ttl, false); // Init memcache (fallback) cache if ($rcmail->config->get('redundant_attachments_memcache')) { - $ttl = 12 * 60 * 60; // 12 hours - $ttl = (int) $rcmail->config->get('redundant_attachments_memcache_ttl', $ttl); $this->mem_cache = $rcmail->get_cache($this->prefix, 'memcache', $ttl, false); } -- cgit v1.2.3