Exemple #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;
 }
Exemple #2
0
 public static function put($id, $val, $timeout = 30)
 {
     $res = MemoryCache::put($id, $val, $timeout);
     $res &= DiskCache::put($id, $val);
     return $res;
 }