summaryrefslogtreecommitdiff
path: root/program/include/rcube_imap.php
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2012-02-21 21:43:39 +0000
committerthomascube <thomas@roundcube.net>2012-02-21 21:43:39 +0000
commitfec2d8e1309d1f16f9cd772b82b28627d9359354 (patch)
tree84a7d8d9276822535c6bfb2fd8429258df3436cf /program/include/rcube_imap.php
parent965e6276b3bf20545bcec46f87ef13ffadfac6c3 (diff)
Refactored IMAP cache expunge: delegate to storage object; don't rely on deprecated 'enable_caching' config option
Diffstat (limited to 'program/include/rcube_imap.php')
-rw-r--r--program/include/rcube_imap.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 56b5e59fe..70b410ff8 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -3527,7 +3527,8 @@ class rcube_imap extends rcube_storage
{
if ($this->caching && !$this->cache) {
$rcmail = rcmail::get_instance();
- $this->cache = $rcmail->get_cache('IMAP', $this->caching);
+ $ttl = $rcmail->config->get('message_cache_lifetime', '10d') - mktime();
+ $this->cache = $rcmail->get_cache('IMAP', $this->caching, $ttl);
}
return $this->cache;
@@ -3574,6 +3575,20 @@ class rcube_imap extends rcube_storage
}
}
+ /**
+ * Delete outdated cache entries
+ */
+ public function expunge_cache()
+ {
+ if ($this->mcache) {
+ $ttl = rcmail::get_instance()->config->get('message_cache_lifetime', '10d');
+ $this->mcache->expunge($ttl);
+ }
+
+ if ($this->cache)
+ $this->cache->expunge();
+ }
+
/* --------------------------------
* message caching methods