summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcube_imap.php
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2012-02-21 21:43:39 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2012-02-21 21:43:39 +0000
commit13161d3135a52e80f01bf7923d711f2945649348 (patch)
tree6c002c5ce6227e5eb2581f3be06577b267c617da /roundcubemail/program/include/rcube_imap.php
parent333be7a2a0b9b10af7f2190c574b3f560b12b3ed (diff)
Refactored IMAP cache expunge: delegate to storage object; don't rely on deprecated 'enable_caching' config option
git-svn-id: https://svn.roundcube.net/trunk@5898 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_imap.php')
-rw-r--r--roundcubemail/program/include/rcube_imap.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/roundcubemail/program/include/rcube_imap.php b/roundcubemail/program/include/rcube_imap.php
index 56b5e59fe..70b410ff8 100644
--- a/roundcubemail/program/include/rcube_imap.php
+++ b/roundcubemail/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