original_string: public static function ActiveStore($ForceMethod = NULL) {
        // Get the active cache name
        $ActiveCache = self::ActiveCache();
        if (!is_null($ForceMethod))
           $ActiveCache = $ForceMethod;
        $ActiveCache = ucfirst($ActiveCache);
        
        // Overrides
        if (defined('CACHE_STORE_OVERRIDE') && defined('CACHE_METHOD_OVERRIDE') && CACHE_METHOD_OVERRIDE == $ActiveCache)
           return unserialize(CACHE_STORE_OVERRIDE);
        
        $apc = false;
        if (C('Garden.Apc', false) && C('Garden.Cache.ApcPrecache', false) && function_exists('apc_fetch'))
           $apc = true;
        
        $LocalStore = null;
        $ActiveStore = null;
        $ActiveStoreKey = "Cache.{$ActiveCache}.Store";
        
        // Check memory
        if (is_null($LocalStore)) {
           if (array_key_exists($ActiveCache, Gdn_Cache::$Stores)) {
              $LocalStore = Gdn_Cache::$Stores[$ActiveCache];
           }
        }
        
        // Check APC cache
        if (is_null($LocalStore) && $apc) {
           $LocalStore = apc_fetch($ActiveStoreKey);
           if ($LocalStore) {
              Gdn_Cache::$Stores[$ActiveCache] = $LocalStore;
           }
        }
        
        if (is_array($LocalStore)) {
           
           // Convert to ActiveStore format (with 'Active' key)
           $Save = false;
           $ActiveStore = array();
           foreach ($LocalStore as $StoreServerName => &$StoreServer) {
              $IsDelayed = &$StoreServer['Delay'];
              $IsActive = &$StoreServer['Active'];
              
              if (is_numeric($IsDelayed)) {
                 if ($IsDelayed < time()) {
                    $IsActive = true;
                    $IsDelayed = false;
                    $StoreServer['Fails'] = 0;
                    $Save = true;
                 } else {
                    if ($IsActive) {
                       $IsActive = false;
                       $Save = true;
                    }
                 }
              }
  
              // Add active servers to ActiveStore array
              if ($IsActive)
                 $ActiveStore[] = $StoreServer['Server'];
           }
           
        }
  
        // No local copy, get from config
        if (is_null($ActiveStore)) {
           $ActiveStore = C($ActiveStoreKey, false);
  
           // Convert to LocalStore format
           $LocalStore = array();
           $ActiveStore = (array)$ActiveStore;
           foreach ($ActiveStore as $StoreServer) {
              $StoreServerName = md5($StoreServer);
              $LocalStore[$StoreServerName] = array(
                 'Server' => $StoreServer,
                 'Active' => true,
                 'Delay'  => false,
                 'Fails'  => 0
              );
           }
           
           $Save = true;
        }
        
        if ($Save) {
           // Save to memory
           Gdn_Cache::$Stores[$ActiveCache] = $LocalStore;
  
           // Save back to APC for later
           if ($apc) {
              apc_store($ActiveStoreKey, $LocalStore, Gdn_Cache::APC_CACHE_DURATION);
           }
        }
        
        return $ActiveStore;
     }
code: public static function ActiveStore($ForceMethod = NULL) {
        // Get the active cache name
        $ActiveCache = self::ActiveCache();
        if (!is_null($ForceMethod))
           $ActiveCache = $ForceMethod;
        $ActiveCache = ucfirst($ActiveCache);
        
        // Overrides
        if (defined('CACHE_STORE_OVERRIDE') && defined('CACHE_METHOD_OVERRIDE') && CACHE_METHOD_OVERRIDE == $ActiveCache)
           return unserialize(CACHE_STORE_OVERRIDE);
        
        $apc = false;
        if (C('Garden.Apc', false) && C('Garden.Cache.ApcPrecache', false) && function_exists('apc_fetch'))
           $apc = true;
        
        $LocalStore = null;
        $ActiveStore = null;
        $ActiveStoreKey = "Cache.{$ActiveCache}.Store";
        
        // Check memory
        if (is_null($LocalStore)) {
           if (array_key_exists($ActiveCache, Gdn_Cache::$Stores)) {
              $LocalStore = Gdn_Cache::$Stores[$ActiveCache];
           }
        }
        
        // Check APC cache
        if (is_null($LocalStore) && $apc) {
           $LocalStore = apc_fetch($ActiveStoreKey);
           if ($LocalStore) {
              Gdn_Cache::$Stores[$ActiveCache] = $LocalStore;
           }
        }
        
        if (is_array($LocalStore)) {
           
           // Convert to ActiveStore format (with 'Active' key)
           $Save = false;
           $ActiveStore = array();
           foreach ($LocalStore as $StoreServerName => &$StoreServer) {
              $IsDelayed = &$StoreServer['Delay'];
              $IsActive = &$StoreServer['Active'];
              
              if (is_numeric($IsDelayed)) {
                 if ($IsDelayed < time()) {
                    $IsActive = true;
                    $IsDelayed = false;
                    $StoreServer['Fails'] = 0;
                    $Save = true;
                 } else {
                    if ($IsActive) {
                       $IsActive = false;
                       $Save = true;
                    }
                 }
              }
  
              // Add active servers to ActiveStore array
              if ($IsActive)
                 $ActiveStore[] = $StoreServer['Server'];
           }
           
        }
  
        // No local copy, get from config
        if (is_null($ActiveStore)) {
           $ActiveStore = C($ActiveStoreKey, false);
  
           // Convert to LocalStore format
           $LocalStore = array();
           $ActiveStore = (array)$ActiveStore;
           foreach ($ActiveStore as $StoreServer) {
              $StoreServerName = md5($StoreServer);
              $LocalStore[$StoreServerName] = array(
                 'Server' => $StoreServer,
                 'Active' => true,
                 'Delay'  => false,
                 'Fails'  => 0
              );
           }
           
           $Save = true;
        }
        
        if ($Save) {
           // Save to memory
           Gdn_Cache::$Stores[$ActiveCache] = $LocalStore;
  
           // Save back to APC for later
           if ($apc) {
              apc_store($ActiveStoreKey, $LocalStore, Gdn_Cache::APC_CACHE_DURATION);
           }
        }
        
        return $ActiveStore;
     }
code_tokens: public static function ActiveStore ( $ ForceMethod = NULL ) { // Get the active cache name $ ActiveCache = self :: ActiveCache ( ) ; if ( ! is_null ( $ ForceMethod ) ) $ ActiveCache = $ ForceMethod ; $ ActiveCache = ucfirst ( $ ActiveCache ) ; // Overrides if ( defined ( 'CACHE_STORE_OVERRIDE' ) && defined ( 'CACHE_METHOD_OVERRIDE' ) && CACHE_METHOD_OVERRIDE == $ ActiveCache ) return unserialize ( CACHE_STORE_OVERRIDE ) ; $ apc = false ; if ( C ( 'Garden.Apc' , false ) && C ( 'Garden.Cache.ApcPrecache' , false ) && function_exists ( 'apc_fetch' ) ) $ apc = true ; $ LocalStore = null ; $ ActiveStore = null ; $ ActiveStoreKey = "Cache.{$ActiveCache}.Store" ; // Check memory if ( is_null ( $ LocalStore ) ) { if ( array_key_exists ( $ ActiveCache , Gdn_Cache :: $ Stores ) ) { $ LocalStore = Gdn_Cache :: $ Stores [ $ ActiveCache ] ; } } // Check APC cache if ( is_null ( $ LocalStore ) && $ apc ) { $ LocalStore = apc_fetch ( $ ActiveStoreKey ) ; if ( $ LocalStore ) { Gdn_Cache :: $ Stores [ $ ActiveCache ] = $ LocalStore ; } } if ( is_array ( $ LocalStore ) ) { // Convert to ActiveStore format (with 'Active' key) $ Save = false ; $ ActiveStore = array ( ) ; foreach ( $ LocalStore as $ StoreServerName => & $ StoreServer ) { $ IsDelayed = & $ StoreServer [ 'Delay' ] ; $ IsActive = & $ StoreServer [ 'Active' ] ; if ( is_numeric ( $ IsDelayed ) ) { if ( $ IsDelayed < time ( ) ) { $ IsActive = true ; $ IsDelayed = false ; $ StoreServer [ 'Fails' ] = 0 ; $ Save = true ; } else { if ( $ IsActive ) { $ IsActive = false ; $ Save = true ; } } } // Add active servers to ActiveStore array if ( $ IsActive ) $ ActiveStore [ ] = $ StoreServer [ 'Server' ] ; } } // No local copy, get from config if ( is_null ( $ ActiveStore ) ) { $ ActiveStore = C ( $ ActiveStoreKey , false ) ; // Convert to LocalStore format $ LocalStore = array ( ) ; $ ActiveStore = ( array ) $ ActiveStore ; foreach ( $ ActiveStore as $ StoreServer ) { $ StoreServerName = md5 ( $ StoreServer ) ; $ LocalStore [ $ StoreServerName ] = array ( 'Server' => $ StoreServer , 'Active' => true , 'Delay' => false , 'Fails' => 0 ) ; } $ Save = true ; } if ( $ Save ) { // Save to memory Gdn_Cache :: $ Stores [ $ ActiveCache ] = $ LocalStore ; // Save back to APC for later if ( $ apc ) { apc_store ( $ ActiveStoreKey , $ LocalStore , Gdn_Cache :: APC_CACHE_DURATION ) ; } } return $ ActiveStore ; }
docstring: Returns the storage data for the active cache
  
  For FileCache, the folder. For Memcache, the server(s).
  
  @param type $ForceMethod
  @return mixed Active Store Location
docstring_tokens: Returns the storage data for the active cache