/** * Instantiate a cache. */ function __construct($context, $cacheId, $fallback, $hostname, $port) { parent::__construct($context, $cacheId, $fallback); $this->connection = new Memcache(); if (!$this->connection->connect($hostname, $port)) { $this->connection = null; } $this->flag = null; $this->expire = 3600; // 1 hour default expiry }
/** * Instantiate a cache. */ function __construct($context, $cacheId, $fallback, $path) { parent::__construct($context, $cacheId, $fallback); $this->filename = $path . DIRECTORY_SEPARATOR . "fc-{$context}-" . str_replace('/', '.', $cacheId) . '.php'; // Load the cache data if it exists. if (($fp = @fopen($this->filename, 'r')) !== false) { flock($fp, LOCK_SH); $this->cache = (include $this->filename); flock($fp, LOCK_UN); } else { $this->cache = null; } }
/** * Instantiate a cache. */ function __construct($context, $cacheId, $fallback) { parent::__construct($context, $cacheId, $fallback); }