Ejemplo n.º 1
0
 function &cachedExecute($arr = null, $timeout = 30)
 {
     if (function_exists('hash')) {
         $hash = 'sqlc' . hash('sha1', $this->queryString . serialize($arr));
     } else {
         $hash = 'sqlc' . sha1($this->queryString . serialize($arr));
     }
     if (MemoryCache::find($hash)) {
         return MemoryCache::get($hash);
     }
     $this->execute($arr);
     if (!$this->rowCount()) {
         $rows = array();
     } else {
         $rows = $this->fetchAll();
     }
     MemoryCache::put($hash, $rows, $timeout);
     return $rows;
 }
Ejemplo n.º 2
0
 public static function &get($id)
 {
     if (MemoryCache::find($id)) {
         return MemoryCache::get($id);
     }
     if (DiskCache::find($id)) {
         return DiskCache::get($id);
     }
     return null;
 }