[Svn] r5767 - branches/devel-framework/roundcubemail/program/include

trac at roundcube.net trac at roundcube.net
Fri Jan 13 10:31:20 CET 2012


Author: alec
Date: 2012-01-13 03:31:20 -0600 (Fri, 13 Jan 2012)
New Revision: 5767

Modified:
   branches/devel-framework/roundcubemail/program/include/rcube_imap.php
Log:
- Improved performance by caching storage server's capabilities in session


Modified: branches/devel-framework/roundcubemail/program/include/rcube_imap.php
===================================================================
--- branches/devel-framework/roundcubemail/program/include/rcube_imap.php	2012-01-13 09:25:11 UTC (rev 5766)
+++ branches/devel-framework/roundcubemail/program/include/rcube_imap.php	2012-01-13 09:31:20 UTC (rev 5767)
@@ -353,7 +353,7 @@
 
 
     /**
-     * Returns the IMAP server's capability
+     * Returns the IMAP server's capability.
      *
      * @param   string  $cap Capability name
      *
@@ -361,12 +361,18 @@
      */
     public function get_capability($cap)
     {
-        if (!$this->check_connection()) {
-            return false;
+        $cap      = strtoupper($cap);
+        $sess_key = "STORAGE_$cap";
+
+        if (!isset($_SESSION[$sess_key])) {
+            if (!$this->check_connection()) {
+                return false;
+            }
+
+            $_SESSION[$sess_key] = $this->conn->getCapability($cap);
         }
 
-        // @TODO: cache capabilities or store in session (?)
-        return $this->conn->getCapability(strtoupper($cap));
+        return $_SESSION[$sess_key];
     }
 
 

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list