Last active
October 9, 2015 11:48
-
-
Save leopro/3500049 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_once __DIR__.'/../app/AppCache.php'; | |
$kernel = new AppCache($kernel); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>cached {{ value }}</p> | |
{% render 'AcmeMyBundle:My:uncached' with {}, {'standalone': true} %} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | |
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; | |
class MyController | |
{ | |
/** | |
* @Template() | |
* @Cache(smaxage="600") | |
*/ | |
public function cachedAction() | |
{ | |
$value = uniqid(); | |
return array('value' => $value); | |
} | |
/** | |
* @Template() | |
*/ | |
public function uncachedAction() | |
{ | |
$value = uniqid(); | |
return array('value' => $value); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_internal: | |
resource: "@FrameworkBundle/Resources/config/routing/internal.xml" | |
prefix: /_internal | |
cached: | |
pattern: /cached | |
defaults: { _controller: AcmeMyBundle:My:cached } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>uncached {{ value }}</p> |
Have you found a solution ?
A solution for what?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"By setting standalone to true, you tell Symfony2 that the action should be rendered as an ESI tag."
http://symfony.com/doc/current/book/http_cache.html#using-edge-side-includes