composer require phpfastcache/phpfastcache-bundle
# PhpFastCache configuration
php_fast_cache:
drivers:
filecache:
type: Files
parameters:
path: "%kernel.cache_dir%/phpfastcache/"
- More examples in Docs/Example/app/config
$bundles[] = new phpFastCache\Bundle\phpFastCacheBundle();
- See the file Docs/Example/app/AppKernel.php for more information.
public function indexAction(Request $request)
{
$cache = $this->get('phpfastcache')->get('filecache');
$item = $cache->getItem('myAppData');
if (!$item->isHit() || $item->get() === null) {
$item->set('Wy app has now superpowers !!')->expiresAfter(3600);//1 hour
$cache->save($item);
}
// replace this example code with whatever you need
return $this->render('default/index.html.twig', [
'myAppData' => $item->get(),
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'),
]);
}
Found an issue or had an idea ? Come here here and let us know !