summaryrefslogtreecommitdiff
path: root/program/lib/Roundcube/rcube.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-05-25 15:37:46 +0200
committerAleksander Machniak <alec@alec.pl>2013-05-25 15:37:46 +0200
commit50abd557184326f173357b50e7593dc3f452be91 (patch)
treedc5f097ba3eaac279e9f0021172e7dbbc878a706 /program/lib/Roundcube/rcube.php
parenta963a2b38cf571b29543d17edadc46f91caba3aa (diff)
Added shared (cross-user) cache
Diffstat (limited to 'program/lib/Roundcube/rcube.php')
-rw-r--r--program/lib/Roundcube/rcube.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index eea2fde84..a57cad57e 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -258,6 +258,37 @@ class rcube
/**
+ * Initialize and get shared cache object
+ *
+ * @param string $name Cache identifier
+ * @param bool $packed Enables/disables data serialization
+ *
+ * @return rcube_cache_shared Cache object
+ */
+ public function get_cache_shared($name, $packed=true)
+ {
+ $shared_name = "shared_$name";
+
+ if (!isset($this->caches[$shared_name])) {
+ $opt = strtolower($name) . '_cache';
+ $type = $this->config->get($opt);
+ $ttl = $this->config->get($opt . '_ttl');
+
+ if (!$type) {
+ $type = $this->config->get('shared_cache');
+ }
+ if ($ttl === null) {
+ $ttl = $this->config->get('shared_cache_ttl');
+ }
+
+ $this->caches[$shared_name] = new rcube_cache_shared($type, $name, $ttl, $packed);
+ }
+
+ return $this->caches[$shared_name];
+ }
+
+
+ /**
* Create SMTP object and connect to server
*
* @param boolean True if connection should be established