示例#1
0
 /**
  * get the user cache
  * @return OC_Cache
  */
 public static function getUserCache($fast = false)
 {
     if (!self::$user_cache) {
         self::$user_cache_fast = null;
         if (!self::$user_cache_fast && function_exists('xcache_set')) {
             self::$user_cache_fast = new OC_Cache_XCache();
         }
         if (!self::$user_cache_fast && function_exists('apc_store')) {
             self::$user_cache_fast = new OC_Cache_APC();
         }
         self::$user_cache = new OC_Cache_File();
         if (self::$user_cache_fast) {
             self::$user_cache = new OC_Cache_Broker(self::$user_cache_fast, self::$user_cache);
         }
     }
     if ($fast) {
         if (self::$user_cache_fast) {
             return self::$user_cache_fast;
         } else {
             return false;
         }
     }
     return self::$user_cache;
 }