Conversation
c879770 to
20ea6e7
Compare
|
@andrerom can you have a look, mostly at the fos_http_cache.md file ? The |
| Varnish proxy client from FOSHttpCache lib is now used for clearing eZ Http cache, even when using Symfony HttpCache. | ||
| A single `BAN` request is sent to registered purge servers, containing a `X-Location-Id` header. | ||
| This header contains all Location IDs for which objects in cache need to be cleared. | ||
| A single `BAN` request is sent to registered purge servers, containing a `xkey` header. |
There was a problem hiding this comment.
It's not BAN, its typically a PURGE when we deal with xkey
| A single `BAN` request is sent to registered purge servers, containing a `X-Location-Id` header. | ||
| This header contains all Location IDs for which objects in cache need to be cleared. | ||
| A single `BAN` request is sent to registered purge servers, containing a `xkey` header. | ||
| This header contains cache items tags that need to be cleared. |
There was a problem hiding this comment.
item, xkey (side: and fastly) currently only supports clearing one tag per request, so several requests are made.
| * | ||
| * @param array $locationIds Cache resource(s) to purge (e.g. array of URI to purge in a reverse proxy) | ||
| */ | ||
| public function purge($locationIds); |
There was a problem hiding this comment.
Don't think we need to add purge and purgeAll here, its still on the old interface also being implemented.
There was a problem hiding this comment.
Clearly a mistake, it wasn't supposed to end up here.
|
|
||
| $purgeRequest = Request::create('http://localhost/', 'BAN'); | ||
| $purgeRequest->headers->set('X-Location-Id', '(' . implode('|', $locationIds) . ')'); | ||
| $purgeRequest = Request::create('http://localhost/', 'PURGE'); |
There was a problem hiding this comment.
As far as I can tell, this won't work if the server is configured to use HTTPS.
|
|
||
| if (!is_array($locationIds)) { | ||
| $locationIds = array($locationIds); | ||
| // As xkey only support one tag (key) being invalidated at a time, we loop. |
There was a problem hiding this comment.
To align with xkey offical example as is also done in FOS and our VCL PR, lets change this to use key (only for Purges, for response headers for tags we use xkey as automatically used by the VMOD).
|
|
||
| $this->cacheManager->invalidatePath( | ||
| '/', | ||
| ['xkey' => $tag, 'Host' => empty($_SERVER['SERVER_NAME']) ? 'localhost' : $_SERVER['SERVER_NAME']] |
| public function purgeAll() | ||
| { | ||
| $this->cacheManager->invalidate(array('X-Location-Id' => '.*')); | ||
| $this->cacheManager->invalidate(['xkey' => '.*']); |
| $purgeRequest = Request::create('http://localhost/', 'BAN'); | ||
| $purgeRequest->headers->set('X-Location-Id', '(' . implode('|', $locationIds) . ')'); | ||
| $purgeRequest = Request::create('http://localhost/', 'PURGE'); | ||
| $purgeRequest->headers->set('xkey', implode(' ', $tags)); |
| Varnish proxy client from FOSHttpCache lib is now used for clearing eZ Http cache, even when using Symfony HttpCache. | ||
| A single `BAN` request is sent to registered purge servers, containing a `X-Location-Id` header. | ||
| This header contains all Location IDs for which objects in cache need to be cleared. | ||
| It sends, for each cache tag that needs to be expired, a `PURGE` request with a `xkey` header to the registered purge servers. |
9f45ec0 to
8388e6b
Compare
dc22773 to
f00af38
Compare
|
This should be good to merge. Could you update your review if it's good to go for you as well @andrerom ? |
f00af38 to
bfc5b64
Compare
andrerom
left a comment
There was a problem hiding this comment.
Looks good, but what is the failure about?
Hum... |
|
ok that would most likely be buggy test. |
|
Yeah, it seems so. It passes locally on all branches. Restarted it. |
|
Replaced by http://github.com/ezsystems/ezplatform-http-cache. Please do not delete the branch yet. |
Adds support for new multi-tagging capabilities to cache purge clients:
FOSPurgeClientwill iterate over the given cache tags, and send one purge request for eachLocalPurgeClientwill send a unique request, with the tags separated by|, since the symfony Proxy knows how to handle that.Changes since the previous feature branch
fos_http_cache.mdPurgeClientInterfaceTODO
PurgeClientInterface(see Limit BC changes on PurgeClientInterface #1896)