/** * Constructor. * * @param array $options Custom configuration options * * @author Benjamin Carl <*****@*****.**> * @return Doozr_Cache_Service_Container_Memcache * @access public * @throws Doozr_Cache_Service_Exception */ public function __construct(array $options = []) { // do the check and transfer of allowed options parent::__construct($options); // check requirements! if (!extension_loaded('memcache')) { throw new Doozr_Cache_Service_Exception('In order to use memcache container for caching, the memcache extension must be loaded.'); } // Init a connection to server $this->setConnection($this->connect($this->getHostname(), $this->getPort())); // Auto adjust max storage (highwater) if ($this->getHighwaterMarker() === -1) { $serverStatistics = $this->getConnection()->getExtendedStats(); $server = $this->getHostname() . ':' . $this->getPort(); if (isset($serverStatistics[$server]['limit_maxbytes']) === false) { throw new Doozr_Cache_Service_Exception(sprintf('Could not retrieve "limit_maxbytes" for server "%s"', $server)); } $this->setHighwaterMarker($serverStatistics[$this->getHostname() . ':' . $this->getPort()]['limit_maxbytes']); } }
/** * Constructor. * * @param array $options Custom configuration options * * @throws Doozr_Cache_Service_Exception * * @author Benjamin Carl <*****@*****.**> * * @return Doozr_Cache_Service_Container_Filesystem */ public function __construct(array $options = []) { // Do the check and transfer of allowed options parent::__construct($options); $this->directory(sys_get_temp_dir() . DIRECTORY_SEPARATOR)->prepareFilesystemAccess()->clear(); }