Beispiel #1
0
 /**
  * Creates a singleton of a Kohana Cache group. If no group is supplied
  * the __default__ cache group is used.
  *
  *     // Create an instance of the default group
  *     $default_group = Cache::instance();
  *
  *     // Create an instance of a group
  *     $foo_group = Cache::instance('foo');
  *
  *     // Access an instantiated group directly
  *     $foo_group = Cache::$instances['default'];
  *
  * @param   string   the name of the cache group to use [Optional]
  * @return  Anqh_Cache
  * @throws  Kohana_Cache_Exception
  */
 public static function instance($group = NULL)
 {
     return parent::instance($group);
 }
Beispiel #2
0
 private function selectExecute()
 {
     $select = DB::select()->from($this->table);
     foreach ($this->where as $key => $value) {
         $select->where($key, '=', $value);
     }
     if ($this->cached) {
         $keycache = $this->getKeyCached();
         $cache = Kohana_Cache::instance('memcache')->get($keycache);
         if ($cache !== null) {
             return $cache;
         }
     }
     if ($this->limit == 1) {
         $select = $select->execute()->current();
     } else {
         $select = $select->execute()->as_array();
     }
     if ($this->cached) {
         Kohana_Cache::instance('memcache')->set($keycache, $select, $this->cached);
     }
     if ($select) {
         return $select;
     }
     return false;
 }