Created
February 18, 2013 16:10
-
-
Save henriquemoody/4978479 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class FluentCache implements \ArrayAccess | |
{ | |
private $cache; | |
public function __construct(\Doctrine\Common\Cache\Cache $cache) | |
{ | |
$this->cache = $cache; | |
} | |
public function offsetExists($id) | |
{ | |
return $this->cache->contains($id); | |
} | |
public function offsetGet($id) | |
{ | |
return $this->cache->fetch($id); | |
} | |
public function offsetSet($id, $data) | |
{ | |
return $this->cache->save($id, $data); | |
} | |
public function offsetUnset($id) | |
{ | |
return $this->cache->delete($id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment