Changeset 5303 in subversion


Ignore:
Timestamp:
Oct 3, 2011 1:52:35 PM (21 months ago)
Author:
alec
Message:
  • Fix: skip redundant cache queries when an entry doesn't exist
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_cache.php

    r5278 r5303  
    246246        } 
    247247 
    248         if ($this->type == 'memcache') { 
    249             $data = $this->db->get($this->ckey($key)); 
    250         } 
    251         else if ($this->type == 'apc') { 
    252             $data = apc_fetch($this->ckey($key)); 
    253             } 
    254  
    255         if ($data) { 
    256             $md5sum = md5($data); 
    257             $data   = $this->packed ? unserialize($data) : $data; 
    258  
    259             if ($nostore) { 
    260                 return $data; 
    261             } 
    262  
    263             $this->cache_sums[$key] = $md5sum; 
    264             $this->cache[$key]      = $data; 
    265         } 
    266  
    267         if ($this->type == 'db') { 
     248        if ($this->type != 'db') { 
     249            if ($this->type == 'memcache') { 
     250                $data = $this->db->get($this->ckey($key)); 
     251            } 
     252            else if ($this->type == 'apc') { 
     253                $data = apc_fetch($this->ckey($key)); 
     254                } 
     255 
     256            if ($data) { 
     257                $md5sum = md5($data); 
     258                $data   = $this->packed ? unserialize($data) : $data; 
     259 
     260                if ($nostore) { 
     261                    return $data; 
     262                } 
     263 
     264                $this->cache_sums[$key] = $md5sum; 
     265                $this->cache[$key]      = $data; 
     266            } 
     267            else if (!$nostore) { 
     268                $this->cache[$key] = null; 
     269            } 
     270        } 
     271        else { 
    268272            $sql_result = $this->db->limitquery( 
    269273                "SELECT cache_id, data, cache_key". 
     
    291295                $this->cache_keys[$key] = $sql_arr['cache_id']; 
    292296            } 
     297            else if (!$nostore) { 
     298                $this->cache[$key] = null; 
     299            } 
    293300        } 
    294301 
Note: See TracChangeset for help on using the changeset viewer.