Changeset 5767 in subversion for branches/devel-framework/roundcubemail


Ignore:
Timestamp:
Jan 13, 2012 4:31:20 AM (17 months ago)
Author:
alec
Message:
  • Improved performance by caching storage server's capabilities in session
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/devel-framework/roundcubemail/program/include/rcube_imap.php

    r5766 r5767  
    354354 
    355355    /** 
    356      * Returns the IMAP server's capability 
     356     * Returns the IMAP server's capability. 
    357357     * 
    358358     * @param   string  $cap Capability name 
     
    362362    public function get_capability($cap) 
    363363    { 
    364         if (!$this->check_connection()) { 
    365             return false; 
    366         } 
    367  
    368         // @TODO: cache capabilities or store in session (?) 
    369         return $this->conn->getCapability(strtoupper($cap)); 
     364        $cap      = strtoupper($cap); 
     365        $sess_key = "STORAGE_$cap"; 
     366 
     367        if (!isset($_SESSION[$sess_key])) { 
     368            if (!$this->check_connection()) { 
     369                return false; 
     370            } 
     371 
     372            $_SESSION[$sess_key] = $this->conn->getCapability($cap); 
     373        } 
     374 
     375        return $_SESSION[$sess_key]; 
    370376    } 
    371377 
Note: See TracChangeset for help on using the changeset viewer.