Skip to content

Instantly share code, notes, and snippets.

@tvlooy
Created October 16, 2013 12:09
Show Gist options
  • Save tvlooy/7006707 to your computer and use it in GitHub Desktop.
Save tvlooy/7006707 to your computer and use it in GitHub Desktop.
User cache Symfony2
In config.yml:
services:
cache:
class: Doctrine\Common\Cache\ApcCache
In code:
if ($this->get('cache')->contains('menu')) {
$menu = unserialize($this->get('cache')->fetch('menu'));
} else {
$menu = /* IMPLEMENTATION_NEEDED */
$this->get('cache')->save('menu', serialize($menu));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment