ezplatform-http-cache icon indicating copy to clipboard operation
ezplatform-http-cache copied to clipboard

Added support for caching REST api calls to POST /api/ezp/v2/views

Open vidarl opened this issue 3 years ago • 0 comments

Question Answer
JIRA issue N/A
Type Feature
Target version 2.0
BC breaks no
Doc needed no

This is a change to the varnish .vcl that makes it possible to cache POST requests to /api/ezp/v2/views (which is basically a search ). The /api/ezp/v2/views endpoint do not provide xkey header in the response so purging won't work, thus the TTL is set to 600 by default.

Don't think we should merge this as-is ( /api/ezp/v2/views should defently provide xkey headers first ). But posting the code here for reference. It might be valuable to others too.

Credits to @reithor and @adriendupuis who also worked on this code

TODO:

  • [x] Implement feature / fix a bug.
  • [ ] Implement tests + specs and passing ($ composer test)
  • [ ] Fix new code according to Coding Standards ($ composer fix-cs).
  • [ ] Ask for Code Review.

vidarl avatar Apr 15 '21 08:04 vidarl