{"action":"created","issue":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/224","labels_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/224/labels{/name}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/224/comments","events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/224/events","html_url":"https://github.com/FriendsOfSymfony/FOSHttpCacheBundle/issues/224","id":88973203,"number":224,"title":"Configuration or annotation invalidation not working in Symfony 2.7.1","user":{"login":"benr77","id":2156742,"avatar_url":"https://avatars.githubusercontent.com/u/2156742?v=3","gravatar_id":"","url":"https://api.github.com/users/benr77","html_url":"https://github.com/benr77","followers_url":"https://api.github.com/users/benr77/followers","following_url":"https://api.github.com/users/benr77/following{/other_user}","gists_url":"https://api.github.com/users/benr77/gists{/gist_id}","starred_url":"https://api.github.com/users/benr77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benr77/subscriptions","organizations_url":"https://api.github.com/users/benr77/orgs","repos_url":"https://api.github.com/users/benr77/repos","events_url":"https://api.github.com/users/benr77/events{/privacy}","received_events_url":"https://api.github.com/users/benr77/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-06-17T09:57:31Z","updated_at":"2015-07-05T13:48:01Z","closed_at":null,"body":"Hi,\r\n\r\nI'm setting up this bundle on Symfony 2.7.1 using the Symfony2 proxy client and of course the Symfony2 HttpCache. If I manually set up invalidation rules in the controller action methods, it works fine and I can see the PURGE requests appearing in the web server logs and the cache is cleared successfully.\r\n\r\nHowever, I cannot get any invalidation to work with the invalidation rules specified either in the YML or as Annotations.\r\n\r\nHere is my config\r\n\r\n```\r\nfos_http_cache:\r\n  proxy_client:\r\n    symfony:\r\n      servers: 127.0.0.1\r\n      base_url: dev.localhost\r\n  cache_control:\r\n    defaults:\r\n      overwrite: true\r\n    rules:\r\n      -\r\n        match:\r\n          attributes:\r\n            _route: ^booking$\r\n        headers:\r\n          cache_control: { public: true, max_age: 0, s_maxage: 64000 }\r\n          etag: true\r\n          vary: [Accept-Encoding]\r\n\r\n      # match everything to set defaults\r\n      -\r\n        match:\r\n          path: ^/\r\n        headers:\r\n          overwrite: false\r\n          cache_control: { public: false, max_age: 0, s_maxage: 0 }\r\n          etag: false\r\n  invalidation:\r\n    rules:\r\n      -\r\n        match:\r\n          attributes: # When hitting these routes\r\n            _route: \"booking_update\"\r\n        routes:       # Invalidate cache for the following routes\r\n          booking: ~\r\n```\r\n\r\nAs you can see I'm asking it to invalidate the \"booking\" route when the \"booking_update\" route is successfully requested. This appears to do nothing.\r\n\r\nI have also tried in the BookingUpdateAction() method the annotation \r\n\r\n`@InvalidateRoute(\"booking\")`\r\n\r\nI have the SensioFrameworkExtra bundle installed as per the docs.\r\n\r\nI have also modified app/AppCache.php as follows:\r\n\r\n```\r\n<?php\r\n\r\nrequire_once __DIR__.'/AppKernel.php';\r\n\r\nuse Symfony\\Component\\HttpKernel\\HttpKernelInterface;\r\nuse FOS\\HttpCacheBundle\\SymfonyCache\\EventDispatchingHttpCache;\r\n\r\n/**\r\n * Class AppCache\r\n */\r\nclass AppCache extends EventDispatchingHttpCache\r\n{\r\n\r\n}\r\n```\r\n\r\nFinally, here is my app_dev.php file\r\n\r\n```\r\n<?php\r\n\r\nuse Symfony\\Component\\HttpFoundation\\Request;\r\nuse Symfony\\Component\\Debug\\Debug;\r\n\r\n$loader = require_once __DIR__.'/../app/bootstrap.php.cache';\r\nDebug::enable();\r\n\r\n//require_once __DIR__.'/../app/AppKernel.php';\r\nrequire_once __DIR__.'/../app/AppCache.php';\r\n\r\n$kernel = new AppKernel('dev', true);\r\n$kernel->loadClassCache();\r\n$kernel = new AppCache($kernel);\r\n\r\nRequest::enableHttpMethodParameterOverride();\r\n$request = Request::createFromGlobals();\r\n\r\n$response = $kernel->handle($request);\r\n\r\n$response->send();\r\n\r\n$kernel->terminate($request, $response);\r\n```\r\n\r\nCan anyone shed any light on why the invalidation does not work unless I define it manually in the controller action method?\r\n\r\nAlternatively, maybe this is a bug with Symfony 2.7.1\r\n\r\nI'm running PHP 5.5.9 on Apache 2.4.7 on Linux Mint 17.1\r\n\r\nThanks\r\n\r\nBen"},"comment":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/comments/118623171","html_url":"https://github.com/FriendsOfSymfony/FOSHttpCacheBundle/issues/224#issuecomment-118623171","issue_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/224","id":118623171,"user":{"login":"ddeboer","id":89267,"avatar_url":"https://avatars.githubusercontent.com/u/89267?v=3","gravatar_id":"","url":"https://api.github.com/users/ddeboer","html_url":"https://github.com/ddeboer","followers_url":"https://api.github.com/users/ddeboer/followers","following_url":"https://api.github.com/users/ddeboer/following{/other_user}","gists_url":"https://api.github.com/users/ddeboer/gists{/gist_id}","starred_url":"https://api.github.com/users/ddeboer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddeboer/subscriptions","organizations_url":"https://api.github.com/users/ddeboer/orgs","repos_url":"https://api.github.com/users/ddeboer/repos","events_url":"https://api.github.com/users/ddeboer/events{/privacy}","received_events_url":"https://api.github.com/users/ddeboer/received_events","type":"User","site_admin":false},"created_at":"2015-07-05T13:48:01Z","updated_at":"2015-07-05T13:48:01Z","body":"The systems are not completely identical:\r\n\r\n* for annotations, we only check whether the response is successful, so any 2xx, including 204 will work\r\n* for configuration, we additionally check whether the response is cacheable (currently [excluding 204]( (erroneously, as I describe in #69)). This is a mistake, though (as I describe in #69): when triggering invalidation we should not check for response cacheability but success instead."}}