Reputation: 95
I've read the tutorials for Symfony and it says that POST requests are never cached. Can I override this so that I can cache the resulted page for the POST request?
Upvotes: 1
Views: 674
Reputation: 10413
kuba's answer is technically correct, but are you sure you want to be caching a POST? If possible, it is preferable to redirect the user, storing some values on the user.
Upvotes: 3
Reputation: 36191
Hopefuly you know that in most cases caching a POST requests is not what you want ;)
Below some tips.
Cache filter
Cache filter is responsible for caching the response. By default symfony uses sfCacheFilter class and you can change it in filters.yml file of your application.
View cache manager
sfCacheFilter doesn't do much. It uses the view cache manager to do all the work.
Default implementation (sfViewCacheManager class) has a isCacheble() method. You could start here as it returns false for everything which is not a GET request.
View cache manager class can be changed in factories.yml file. You could write your own class by extending the sfViewCacheManger and overloading some of its behavior.
Upvotes: 2