Esempio n. 1
0
 /**
  * Find out if APC is enabled
  *
  * @return bool
  */
 public static function isAPCEnabled()
 {
     if (self::$isAPCEnabled == null) {
         $keySuffix = PHP_SAPI == 'cli' ? '_cli' : '';
         self::$isAPCEnabled = ini_get('apc.enabled' . $keySuffix);
     }
     return self::$isAPCEnabled;
 }
Esempio n. 2
0
 /**
  * Protected constructor
  *
  * @return void
  */
 protected function __construct()
 {
     $isAPCEnabled = Resqee::isAPCEnabled();
     if ($isAPCEnabled) {
         $config = apc_fetch(self::APC_KEY_CONFIG . $this->getConfigFile());
         if ($config !== false) {
             $this->config = $config;
         }
     }
     if (empty($this->config)) {
         $this->config = $this->parseConfig($this->getConfigFile());
         if ($isAPCEnabled) {
             apc_add(self::APC_KEY_CONFIG . $this->getConfigFile(), $this->config, self::APC_TTL_CONFIG);
         }
     }
 }
Esempio n. 3
0
 /**
  * Check whether a server is disabled
  *
  * We check local cache and APC
  *
  * @param string|array $hostAndPort localhost:80
  *  or array('host' => localhost, 'port' => 80)
  *
  * @return bool
  */
 public function isServerDisabled($hostAndPort)
 {
     if (is_array($hostAndPort)) {
         $hostAndPort = "{$hostAndPort['host']}:{$hostAndPort['port']}";
     }
     return isset(self::$disabledServers[$hostAndPort]) || Resqee::isAPCEnabled() && apc_fetch(self::APC_KEY_SERVER_DISABLED . $hostAndPort);
 }