/** * @param Registry $Registry */ public function __construct(Registry $Registry) { d('starting Cache'); parent::__construct($Registry); $this->oTtl = new ArrayDefaults(array(), 0); $this->Tmp = new ArrayDefaults(array()); $this->skipCache = $Registry->Ini->SKIP_CACHE; if (!$this->skipCache) { $this->setCacheEngine(Mongo::factory($Registry)); $Registry->Dispatcher->attach($this); } }
/** * Constructor * * @param string $server connection string * (may contain username/password) * like this: * * @param string $db name of database * * @param string $collection name of collection * * @param bool $compress is true then will store values compressed with gzip * to save space (extra processing overhead will be incured to compress/uncompress) */ public function __construct(\Mongo $Mongo, $db, $collection, $nameSpace = null, $compress = false) { if (!extension_loaded('mongo')) { throw new \LogicException('The MongoDB extension must be loaded for using this backend !'); } $this->nameSpace = $nameSpace; if (true === $compress) { if (!function_exists('gzdeflate')) { throw new \LogicException('gzdeflate function not available. Purhaps you php was compiled without the gzip support'); } $this->bCompress = (bool) $compress; } $this->Mongo = $Mongo; $this->_collection = $Mongo->selectCollection($db, $collection); //$this->_db->selectCollection($collection); $this->_collection->ensureIndex(array('tags' => 1)); }