Skip to content

Instantly share code, notes, and snippets.

@henriquemoody
Created February 18, 2013 16:10
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save henriquemoody/4978479 to your computer and use it in GitHub Desktop.
Save henriquemoody/4978479 to your computer and use it in GitHub Desktop.
<?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