From ed1d212ae2daea5e4bd043417610177093e99f19 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Sat, 16 Jan 2016 03:03:51 -0500 Subject: [PATCH] Improved SVG cleanup code --- program/lib/Roundcube/rcube_cache_shared.php | 33 +++++++++------------------------ 1 files changed, 9 insertions(+), 24 deletions(-) diff --git a/program/lib/Roundcube/rcube_cache_shared.php b/program/lib/Roundcube/rcube_cache_shared.php index bd5fb6e..290afe1 100644 --- a/program/lib/Roundcube/rcube_cache_shared.php +++ b/program/lib/Roundcube/rcube_cache_shared.php @@ -1,6 +1,6 @@ <?php -/* +/** +-----------------------------------------------------------------------+ | This file is part of the Roundcube Webmail client | | Copyright (C) 2011-2013, The Roundcube Dev Team | @@ -17,7 +17,6 @@ | Author: Aleksander Machniak <alec@alec.pl> | +-----------------------------------------------------------------------+ */ - /** * Interface class for accessing Roundcube shared cache @@ -89,7 +88,6 @@ $this->prefix = $prefix; } - /** * Returns cached value. * @@ -106,7 +104,6 @@ return $this->cache[$key]; } - /** * Sets (add/update) value in cache. * @@ -118,7 +115,6 @@ $this->cache[$key] = $data; $this->cache_changes[$key] = true; } - /** * Returns cached value without storing it in internal memory. @@ -136,7 +132,6 @@ return $this->read_record($key, true); } - /** * Sets (add/update) value in cache and immediately saves * it in the backend, no internal memory will be used. @@ -150,7 +145,6 @@ { return $this->write_record($key, $this->serialize($data)); } - /** * Clears the cache. @@ -188,7 +182,6 @@ $this->remove_record($key, $prefix_mode); } - /** * Remove cache records older than ttl */ @@ -203,7 +196,6 @@ } } - /** * Remove expired records of all caches */ @@ -214,7 +206,6 @@ $db->query("DELETE FROM " . $db->table_name('cache_shared', true) . " WHERE `expires` < " . $db->now()); } - /** * Writes the cache back to the DB. @@ -237,8 +228,10 @@ if ($this->index_changed) { $this->write_index(); } - } + // reset internal cache index, thanks to this we can force index reload + $this->index = null; + } /** * Reads cache entry. @@ -324,7 +317,6 @@ return $this->cache[$key]; } - /** * Writes single cache record into DB. * @@ -397,7 +389,6 @@ return $this->db->affected_rows($result); } - /** * Deletes the cache record(s). * @@ -460,11 +451,10 @@ $this->db->query("DELETE FROM " . $this->table . $where); } - /** * Adds entry into memcache/apc DB. * - * @param string $key Cache key name + * @param string $key Cache internal key name * @param mixed $data Serialized cache data * * @param boolean True on success, False on failure @@ -493,11 +483,10 @@ return $result; } - /** * Deletes entry from memcache/apc DB. * - * @param string $key Cache key name + * @param string $key Cache internal key name * * @param boolean True on success, False on failure */ @@ -505,19 +494,18 @@ { if ($this->type == 'memcache') { // #1488592: use 2nd argument - $result = $this->db->delete($ckey, 0); + $result = $this->db->delete($key, 0); } else { - $result = apc_delete($ckey); + $result = apc_delete($key); } if ($this->debug) { - $this->debug('delete', $ckey, null, $result); + $this->debug('delete', $key, null, $result); } return $result; } - /** * Writes the index entry into memcache/apc DB. @@ -548,7 +536,6 @@ $this->add_record($this->ikey(), $data); } - /** * Gets the index entry from memcache/apc DB. */ @@ -578,7 +565,6 @@ $this->index = $data ? unserialize($data) : array(); } - /** * Creates cache key name (for memcache and apc) * @@ -590,7 +576,6 @@ { return $this->prefix . ':' . $key; } - /** * Creates index cache key name (for memcache and apc) -- Gitblit v1.9.1