コード例 #1
0
 static function cache($cache = null)
 {
     if (!is_null($cache)) {
         if (!$cache instanceof clCache) {
             throw new Exception('Object %s does not inherit from clCache', get_class($object));
         }
         self::$cache = new clStash($cache);
     }
     if (!self::$cache) {
         try {
             // default is FileCache
             $class = COREYLIB_DEFAULT_CACHE_STRATEGY;
             $cache = new $class();
             self::$cache = new clStash($cache);
         } catch (Exception $e) {
             clApi::log($e, E_USER_WARNING);
             return false;
         }
     }
     return self::$cache;
 }