PHP code example of mapado / cache-info-bundle
1. Go to this page and download the library: Download mapado/cache-info-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mapado / cache-info-bundle example snippets
// AppKernel.php
$bundles = array(
...
new Mapado\CacheInfoBundle\MapadoCacheInfoBundle(),
);
use Mapado\CacheInfoBundle\Annotation\CacheMayBe;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
class FooController
{
/**
* @CacheMayBe(values={@Cache(public=true, smaxage="14400"), @Cache(public=false)})
*/
public function complexRouteAction()
{
$isPublic = // determine if your route is public ...
$response->setPublic($isPublic);
if ($isPublic) {
$response->setSMaxAge(14400);
}
return $response;
}
}