If you are using Doctrine already just use those cache classes.
Add a service to config.yml
:
services:
cache:
class: DoctrineCommonCacheApcCache
And use it in your controller:
if ($fooString = $this->get('cache')->fetch('foo')) {
$foo = unserialize($fooString);
} else {
// do the work
$this->get('cache')->save('foo', serialize($foo));
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…