_serialization === true) ? unserialize($contents) : $contents; } return false; } /** * * create/update cache file * * @param string $name * @param string $type * @param mixed $data * @param int $expires * * @return $this * @throws \RuntimeException */ public function write($name, $type, $data, $expires = null) { if ($this->_serialization === true) { $data = serialize($data); } if ($expires === null) { $expires = $this->getExpires(); } $result = apc_store($type . $name, $data, $expires); if (!$result) { throw new \RuntimeException( sprintf("APC store failure - '%s'.", $name)); } return $this; } /** * * delete a variable from cache * * @param string $name * @param string $type * * @return boolean */ public function delete($name, $type) { return apc_delete($type . $name); } /** * * purge cache * - for APC cache variables expire automatically so this method does nothing * * @param string $type * @param boolean $force * * @return $this */ public function purge($type, $force = false) { return $this; } /** * * clear cache * * @return $this */ public function clear() { apc_clear_cache(); return $this; } }