diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-05-18 12:10:27 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-05-18 12:10:27 +0000 |
| commit | 9b89dcb37c5972d8dfd56fb696feea29c2e10bb6 (patch) | |
| tree | 8a56bf1d7b1155f89ad59ef1d190fea3c5d263ac | |
| parent | 93e40546276c2a222d5faee372be3bcebafcf7ba (diff) | |
- Make memcached cache not system-wide
git-svn-id: https://svn.roundcube.net/trunk@4784 208e9e7b-5314-0410-a742-e7e81cd9613c
| -rw-r--r-- | roundcubemail/program/include/rcube_cache.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/roundcubemail/program/include/rcube_cache.php b/roundcubemail/program/include/rcube_cache.php index d38c237c8..dda09885c 100644 --- a/roundcubemail/program/include/rcube_cache.php +++ b/roundcubemail/program/include/rcube_cache.php @@ -208,7 +208,7 @@ class rcube_cache } if ($this->type == 'memcache') { - $data = $this->db->get($key); + $data = $this->db->get($this->mc_key($key)); if ($data) { $this->cache_sums[$key] = md5($data); @@ -263,6 +263,7 @@ class rcube_cache } if ($this->type == 'memcache') { + $key = $this->mc_key($key); $result = $this->db->replace($key, $data, MEMCACHE_COMPRESSED); if (!$result) $result = $this->db->set($key, $data, MEMCACHE_COMPRESSED); @@ -313,7 +314,7 @@ class rcube_cache } if ($this->type == 'memcache') { - return $this->db->delete($key); + return $this->db->delete($this->mc_key($key)); } $this->db->query( @@ -325,4 +326,15 @@ class rcube_cache unset($this->cache_keys[$key]); } + + /** + * Creates per-user Memcache key + * + * @param string $key Cache key + * @access private + */ + private function mc_key($key) + { + return sprintf('[%d]%s', $this->userid, $key); + } } |
