summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcmail.php
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-05-23 09:34:57 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-05-23 09:34:57 +0000
commit7e5e85b85bdc4a7dbdb9f14d8e1b0b3b5ee44cda (patch)
tree783ee4fa9069101b244aa2350013cf585f94a741 /roundcubemail/program/include/rcmail.php
parent25d8ceffc5bd46d0d63e056fdc5db089279bee1f (diff)
- Add TTL parameter to rcube_cache class (and rcmail::get_cache method)
git-svn-id: https://svn.roundcube.net/trunk@4801 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcmail.php')
-rw-r--r--roundcubemail/program/include/rcmail.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/roundcubemail/program/include/rcmail.php b/roundcubemail/program/include/rcmail.php
index 7844b9806..acd661d8b 100644
--- a/roundcubemail/program/include/rcmail.php
+++ b/roundcubemail/program/include/rcmail.php
@@ -333,7 +333,7 @@ class rcmail
$this->memcache = false;
return false;
}
-
+
$this->memcache = new Memcache;
$mc_available = 0;
foreach ($this->config->get('memcache_hosts', array()) as $host) {
@@ -343,11 +343,11 @@ class rcmail
if ($this->memcache->addServer($host, $port) && !$mc_available)
$mc_available += intval($this->memcache->connect($host, $port));
}
-
+
if (!$mc_available)
$this->memcache = false;
}
-
+
return $this->memcache;
}
@@ -357,13 +357,14 @@ class rcmail
*
* @param string $name Cache identifier
* @param string $type Cache type ('db', 'apc' or 'memcache')
+ * @param int $ttl Expiration time for cache items in seconds
*
* @return rcube_cache Cache object
*/
- public function get_cache($name, $type)
+ public function get_cache($name, $type='db', $ttl=0)
{
if (!isset($this->caches[$name])) {
- $this->caches[$name] = new rcube_cache($type, $_SESSION['user_id'], $name);
+ $this->caches[$name] = new rcube_cache($type, $_SESSION['user_id'], $name, $ttl);
}
return $this->caches[$name];