[Svn] r6108 - trunk/roundcubemail/program/include

trac at roundcube.net trac at roundcube.net
Sat Apr 21 18:28:03 CEST 2012


Author: thomasb
Date: 2012-04-21 11:28:03 -0500 (Sat, 21 Apr 2012)
New Revision: 6108

Modified:
   trunk/roundcubemail/program/include/rcube_imap.php
Log:
Revert r6094; Add caching for ACL and Metadata

Modified: trunk/roundcubemail/program/include/rcube_imap.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap.php	2012-04-21 16:25:20 UTC (rev 6107)
+++ trunk/roundcubemail/program/include/rcube_imap.php	2012-04-21 16:28:03 UTC (rev 6108)
@@ -566,8 +566,8 @@
     {
         $mode = strtoupper($mode);
 
-        // count search set
-        if ($this->search_string && $folder == $this->folder && ($mode == 'ALL' || $mode == 'THREADS') && !$force) {
+        // count search set, assume search set is always up-to-date (don't check $force flag)
+        if ($this->search_string && $folder == $this->folder && ($mode == 'ALL' || $mode == 'THREADS')) {
             if ($mode == 'ALL') {
                 return $this->search_set->count_messages();
             }
@@ -3144,6 +3144,13 @@
             return $this->icache['options'];
         }
 
+        // get cached metadata
+        $cache_key = 'mailboxes.folder-info.' . $folder;
+        $cached = $this->get_cache($cache_key);
+
+        if (is_array($cached))
+            return $cached;
+
         $acl       = $this->get_capability('ACL');
         $namespace = $this->get_namespace();
         $options   = array();
@@ -3206,7 +3213,9 @@
             $options['norename'] = $options['is_root'] || $options['namespace'] != 'personal';
         }
 
+        // update caches
         $this->icache['options'] = $options;
+        $this->update_cache($cache_key, $options);
 
         return $options;
     }
@@ -3272,6 +3281,8 @@
             return false;
         }
 
+        $this->clear_cache('mailboxes.folder-info.' . $folder);
+
         return $this->conn->setACL($folder, $user, $acl);
     }
 
@@ -3385,6 +3396,8 @@
             return false;
         }
 
+        $this->clear_cache('mailboxes.metadata.' . $folder);
+
         if ($this->get_capability('METADATA') ||
             (!strlen($folder) && $this->get_capability('METADATA-SERVER'))
         ) {
@@ -3417,6 +3430,8 @@
             return false;
         }
 
+        $this->clear_cache('mailboxes.metadata.' . $folder);
+
         if ($this->get_capability('METADATA') || 
             (!strlen($folder) && $this->get_capability('METADATA-SERVER'))
         ) {
@@ -3450,10 +3465,16 @@
             return null;
         }
 
+        $cache_key = 'mailboxes.metadata.' . $folder;
+        if ($cached = $this->get_cache($cache_key))
+            return $cached;
+
         if ($this->get_capability('METADATA') ||
             (!strlen($folder) && $this->get_capability('METADATA-SERVER'))
         ) {
-            return $this->conn->getMetadata($folder, $entries, $options);
+            $res = $this->conn->getMetadata($folder, $entries, $options);
+            $this->update_cache($cache_key, $res);
+            return $res;
         }
         else if ($this->get_capability('ANNOTATEMORE') || $this->get_capability('ANNOTATEMORE2')) {
             $queries = array();
@@ -3472,6 +3493,7 @@
                 }
             }
 
+            $this->update_cache($cache_key, $res);
             return $res;
         }
 



More information about the svn mailing list