Skip to content

Commit

Permalink
Expunge all cache instances in shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed May 25, 2013
1 parent 50abd55 commit 00cb22c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions program/lib/Roundcube/rcube.php
Expand Up @@ -897,6 +897,9 @@ public function shutdown()

foreach ($this->caches as $cache) {
if (is_object($cache)) {
if ($this->expunge_cache) {
$cache->expunge();
}
$cache->close();
}
}
Expand Down
2 changes: 1 addition & 1 deletion program/lib/Roundcube/rcube_cache.php
Expand Up @@ -192,7 +192,7 @@ function remove($key=null, $prefix_mode=false)
*/
function expunge()
{
if ($this->type == 'db' && $this->db) {
if ($this->type == 'db' && $this->db && $this->ttl) {
$this->db->query(
"DELETE FROM ".$this->db->table_name('cache').
" WHERE user_id = ?".
Expand Down
2 changes: 1 addition & 1 deletion program/lib/Roundcube/rcube_cache_shared.php
Expand Up @@ -191,7 +191,7 @@ function remove($key=null, $prefix_mode=false)
*/
function expunge()
{
if ($this->type == 'db' && $this->db) {
if ($this->type == 'db' && $this->db && $this->ttl) {
$this->db->query(
"DELETE FROM " . $this->table
. " WHERE cache_key LIKE ?"
Expand Down
3 changes: 3 additions & 0 deletions program/lib/Roundcube/rcube_imap.php
Expand Up @@ -3749,9 +3749,12 @@ public function expunge_cache()
$this->mcache->expunge($ttl);
}

/*
// this cache is expunged by rcube class
if ($this->cache) {
$this->cache->expunge();
}
*/
}


Expand Down

0 comments on commit 00cb22c

Please sign in to comment.