symfony - How do I invalidate cache for a controller url? -


i want invalidate http cache in symfony2. use following method:

protected function invalidatecache($url) {     $ch = curl_init();     curl_setopt($ch, curlopt_url, $url);     curl_setopt($ch, curlopt_customrequest, 'purge');     curl_setopt($ch, curlopt_returntransfer, true);     curl_setopt($ch, curlopt_header, true);      curl_exec($ch);     $status = curl_getinfo($ch, curlinfo_http_code);     curl_close($ch);      return $status == 200; } 

that works, no problem. when use esi include controller() function (not path()) like:

{{ render_esi(controller('acmedemobundle:default:index')) }} 

how url generated controller function? or how can invalidate cached response of esi request?

so here how it: don't.

the reason why wanted use controller() function instead path() because symfony protect url controller() unauthorised requests. should use path() , prefix urls "esi/" , protect url in security.yml.

//app/config/security.yml security:    # // ---   access_control:     - { path: ^/esi/.*, roles: is_authenticated_anonymously, ip: 127.0.0.1 } 

if want clear cache use url would.

thank @jongotlin on twitter helping me this.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -