Branch 'libkolab-cache-bypass' - plugins/libkolab
Aleksander Machniak
machniak at kolabsys.com
Mon Oct 7 15:05:52 CEST 2013
plugins/libkolab/config.inc.php.dist | 6 +++++
plugins/libkolab/lib/kolab_storage_cache.php | 31 ++++++++++++++++++---------
2 files changed, 27 insertions(+), 10 deletions(-)
New commits:
commit 9d174daf9f98e8e60cddf77cf1416e42470ba77b
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Mon Oct 7 15:05:34 2013 +0200
Add option kolab_messages_cache_bypass
diff --git a/plugins/libkolab/config.inc.php.dist b/plugins/libkolab/config.inc.php.dist
index 6260f52..0c612a3 100644
--- a/plugins/libkolab/config.inc.php.dist
+++ b/plugins/libkolab/config.inc.php.dist
@@ -24,3 +24,9 @@ $rcmail_config['kolab_custom_display_names'] = false;
// See http://pear.php.net/manual/en/package.http.http-request2.config.php
// for list of supported configuration options (array keys)
$rcmail_config['kolab_http_request'] = array();
+
+// When kolab_cache is enabled Roundcube's messages cache will be redundant
+// when working on kolab folders. Here we can:
+// 2 - bypass messages/indexes cache completely
+// 1 - bypass only messages, but use index cache
+$rcmail_config['kolab_messages_cache_bypass'] = 0;
diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php
index 3b1d857..0e30dfa 100644
--- a/plugins/libkolab/lib/kolab_storage_cache.php
+++ b/plugins/libkolab/lib/kolab_storage_cache.php
@@ -804,21 +804,32 @@ class kolab_storage_cache
return;
}
- if ($this->messages_cache === null) {
+ static $messages_cache, $cache_bypass;
+
+ if ($messages_cache === null) {
$rcmail = rcube::get_instance();
- $this->messages_cache = (bool) $rcmail->config->get('messages_cache');
+ $messages_cache = (bool) $rcmail->config->get('messages_cache');
+ $cache_bypass = (int) $rcmail->config->get('kolab_messages_cache_bypass');
}
- if ($this->messages_cache) {
- // we'll disable messages cache, but keep index cache
- // default mode is both (MODE_INDEX | MODE_MESSAGE)
- $mode = rcube_imap_cache::MODE_INDEX;
+ if ($messages_cache) {
+ switch ($cache_bypass) {
+ case 2:
+ // Disable messages cache completely
+ $this->imap->set_messages_caching(!$disable);
+ return;
- if (!$disable) {
- $mode |= rcube_imap_cache::MODE_MESSAGE;
- }
+ case 1:
+ // We'll disable messages cache, but keep index cache.
+ // Default mode is both (MODE_INDEX | MODE_MESSAGE)
+ $mode = rcube_imap_cache::MODE_INDEX;
- $this->imap->set_messages_caching(true, $mode);
+ if (!$disable) {
+ $mode |= rcube_imap_cache::MODE_MESSAGE;
+ }
+
+ $this->imap->set_messages_caching(true, $mode);
+ }
}
}
}
More information about the commits
mailing list