cache = new \Memcache(); $this->cache->pconnect('localhost', 11211); } /** * {@inheritdoc} */ protected function doFetch($id) { return $this->cache->get(APP_KEY . '.DOC2::' . $id); } /** * {@inheritdoc} */ protected function doContains($id) { return (bool) $this->cache->get(APP_KEY . '.DOC2::' . $id); } /** * {@inheritdoc} */ protected function doSave($id, $data, $lifeTime = 0) { if ($lifeTime > 30 * 24 * 3600) { $lifeTime = time() + $lifeTime; } return $this->cache->set(APP_KEY . '.DOC2::' . $id, $data, 0, (int) $lifeTime); } /** * {@inheritdoc} */ protected function doDelete($id) { return $this->cache->delete(APP_KEY . '.DOC2::' . $id); } /** * {@inheritdoc} */ protected function doFlush() { return $this->cache->flush(); } /** * {@inheritdoc} */ protected function doGetStats() { return array(); } }