{"action":"created","comment":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/comments/173755324","pull_request_review_id":102994061,"id":173755324,"diff_hunk":"@@ -61,18 +63,35 @@ class Varnish extends HttpProxyClient implements BanCapable, PurgeCapable, Refre\n      */\n     public function invalidateTags(array $tags)\n     {\n+        $tagMode = $this->options['tag_mode'];\n+        $invalidationMethod = \"{$tagMode}TagChunk\";\n         $escapedTags = array_map('preg_quote', $this->escapeTags($tags));\n \n-        $chunkSize = $this->determineTagsPerHeader($escapedTags, '|');\n+        $chunkSize = $this->determineTagsPerHeader($escapedTags, 'ban' === $tagMode ? '|' : ' ');\n \n         foreach (array_chunk($escapedTags, $chunkSize) as $tagchunk) {\n-            $tagExpression = sprintf('(^|,)(%s)(,|$)', implode('|', $tagchunk));\n-            $this->ban([$this->options['tags_header'] => $tagExpression]);\n+            $this->$invalidationMethod($tagchunk);","path":"src/ProxyClient/Varnish.php","position":23,"original_position":23,"commit_id":"ebc0fa454102f676e34af251e2540059a2ca39ff","original_commit_id":"bde7669384e322e15ff10c728077a79f2bc79f89","user":{"login":"andrerom","id":289757,"avatar_url":"https://avatars0.githubusercontent.com/u/289757?v=4","gravatar_id":"","url":"https://api.github.com/users/andrerom","html_url":"https://github.com/andrerom","followers_url":"https://api.github.com/users/andrerom/followers","following_url":"https://api.github.com/users/andrerom/following{/other_user}","gists_url":"https://api.github.com/users/andrerom/gists{/gist_id}","starred_url":"https://api.github.com/users/andrerom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrerom/subscriptions","organizations_url":"https://api.github.com/users/andrerom/orgs","repos_url":"https://api.github.com/users/andrerom/repos","events_url":"https://api.github.com/users/andrerom/events{/privacy}","received_events_url":"https://api.github.com/users/andrerom/received_events","type":"User","site_admin":false},"body":"I agree, just way beyond caring to argue anymore with the input.","created_at":"2018-03-12T10:50:36Z","updated_at":"2018-03-12T10:50:36Z","html_url":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/332#discussion_r173755324","pull_request_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/332","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/comments/173755324"},"html":{"href":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/332#discussion_r173755324"},"pull_request":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/332"}},"in_reply_to_id":173086466},"pull_request":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/332","id":93373983,"html_url":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/332","diff_url":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/332.diff","patch_url":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/332.patch","issue_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/332","number":332,"state":"open","locked":false,"title":"Add support for Varnish xkey","user":{"login":"andrerom","id":289757,"avatar_url":"https://avatars0.githubusercontent.com/u/289757?v=4","gravatar_id":"","url":"https://api.github.com/users/andrerom","html_url":"https://github.com/andrerom","followers_url":"https://api.github.com/users/andrerom/followers","following_url":"https://api.github.com/users/andrerom/following{/other_user}","gists_url":"https://api.github.com/users/andrerom/gists{/gist_id}","starred_url":"https://api.github.com/users/andrerom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrerom/subscriptions","organizations_url":"https://api.github.com/users/andrerom/orgs","repos_url":"https://api.github.com/users/andrerom/repos","events_url":"https://api.github.com/users/andrerom/events{/privacy}","received_events_url":"https://api.github.com/users/andrerom/received_events","type":"User","site_admin":false},"body":"xkey promises to have vastly better performance than invalidation by BAN for two reasons:\r\n- It keeps a hash table of the tags around so it can efficiently do invalidation directly instead of filling up a list of regex bans on request data slowing things down\r\n- It supports soft purge making it able to take into account grace time\r\n\r\nIt can be installed on any supported platform by Varnish 4.1+ as long as people have src files for Varnish, and  is also available on some Linux distros as package.  And besides that, it can be used with [Varnish Plus](http://book.varnish-software.com/4.0/chapters/Cache_Invalidation.html#hashtwo-xkey-varnish-software-implementation-of-surrogate-keys).\r\n\r\nFurther reading:\r\n- Doc: https://github.com/varnish/varnish-modules/blob/master/docs/vmod_xkey.rst\r\n- Wikipedia: https://wikitech.wikimedia.org/wiki/XKey\r\n\r\n\r\n# Doc draft\r\n\r\nConfiguring xkey:\r\n```php\r\n[\r\n    'tags_header' => 'xkey-softpurge',// Or 'xkey-purge' if you can not use grace, see VCL\r\n    'tag_mode' => 'purgekeys',\r\n]\r\n```\r\n\r\n# Todo:\r\n- [x] Compile xkey on travis\r\n  - [x] ~~Figure out why the _(added)_ Varnish 5.2 testing job fails~~ _(move 5.2 support to other pr)_\r\n- [x] Add unit test coverage\r\n- [x] Add functional test coverage","created_at":"2016-11-11T18:11:19Z","updated_at":"2018-03-12T10:50:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"75fa0c364d360c5c06f07cdd1f1cfc4928cffca5","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/332/commits","review_comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/332/comments","review_comment_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/332/comments","statuses_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/statuses/ebc0fa454102f676e34af251e2540059a2ca39ff","head":{"label":"andrerom:xkey","ref":"xkey","sha":"ebc0fa454102f676e34af251e2540059a2ca39ff","user":{"login":"andrerom","id":289757,"avatar_url":"https://avatars0.githubusercontent.com/u/289757?v=4","gravatar_id":"","url":"https://api.github.com/users/andrerom","html_url":"https://github.com/andrerom","followers_url":"https://api.github.com/users/andrerom/followers","following_url":"https://api.github.com/users/andrerom/following{/other_user}","gists_url":"https://api.github.com/users/andrerom/gists{/gist_id}","starred_url":"https://api.github.com/users/andrerom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrerom/subscriptions","organizations_url":"https://api.github.com/users/andrerom/orgs","repos_url":"https://api.github.com/users/andrerom/repos","events_url":"https://api.github.com/users/andrerom/events{/privacy}","received_events_url":"https://api.github.com/users/andrerom/received_events","type":"User","site_admin":false},"repo":{"id":40454540,"name":"FOSHttpCache","full_name":"andrerom/FOSHttpCache","owner":{"login":"andrerom","id":289757,"avatar_url":"https://avatars0.githubusercontent.com/u/289757?v=4","gravatar_id":"","url":"https://api.github.com/users/andrerom","html_url":"https://github.com/andrerom","followers_url":"https://api.github.com/users/andrerom/followers","following_url":"https://api.github.com/users/andrerom/following{/other_user}","gists_url":"https://api.github.com/users/andrerom/gists{/gist_id}","starred_url":"https://api.github.com/users/andrerom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrerom/subscriptions","organizations_url":"https://api.github.com/users/andrerom/orgs","repos_url":"https://api.github.com/users/andrerom/repos","events_url":"https://api.github.com/users/andrerom/events{/privacy}","received_events_url":"https://api.github.com/users/andrerom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andrerom/FOSHttpCache","description":"Integrate your PHP application with your HTTP caching proxy","fork":true,"url":"https://api.github.com/repos/andrerom/FOSHttpCache","forks_url":"https://api.github.com/repos/andrerom/FOSHttpCache/forks","keys_url":"https://api.github.com/repos/andrerom/FOSHttpCache/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andrerom/FOSHttpCache/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andrerom/FOSHttpCache/teams","hooks_url":"https://api.github.com/repos/andrerom/FOSHttpCache/hooks","issue_events_url":"https://api.github.com/repos/andrerom/FOSHttpCache/issues/events{/number}","events_url":"https://api.github.com/repos/andrerom/FOSHttpCache/events","assignees_url":"https://api.github.com/repos/andrerom/FOSHttpCache/assignees{/user}","branches_url":"https://api.github.com/repos/andrerom/FOSHttpCache/branches{/branch}","tags_url":"https://api.github.com/repos/andrerom/FOSHttpCache/tags","blobs_url":"https://api.github.com/repos/andrerom/FOSHttpCache/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andrerom/FOSHttpCache/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andrerom/FOSHttpCache/git/refs{/sha}","trees_url":"https://api.github.com/repos/andrerom/FOSHttpCache/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andrerom/FOSHttpCache/statuses/{sha}","languages_url":"https://api.github.com/repos/andrerom/FOSHttpCache/languages","stargazers_url":"https://api.github.com/repos/andrerom/FOSHttpCache/stargazers","contributors_url":"https://api.github.com/repos/andrerom/FOSHttpCache/contributors","subscribers_url":"https://api.github.com/repos/andrerom/FOSHttpCache/subscribers","subscription_url":"https://api.github.com/repos/andrerom/FOSHttpCache/subscription","commits_url":"https://api.github.com/repos/andrerom/FOSHttpCache/commits{/sha}","git_commits_url":"https://api.github.com/repos/andrerom/FOSHttpCache/git/commits{/sha}","comments_url":"https://api.github.com/repos/andrerom/FOSHttpCache/comments{/number}","issue_comment_url":"https://api.github.com/repos/andrerom/FOSHttpCache/issues/comments{/number}","contents_url":"https://api.github.com/repos/andrerom/FOSHttpCache/contents/{+path}","compare_url":"https://api.github.com/repos/andrerom/FOSHttpCache/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andrerom/FOSHttpCache/merges","archive_url":"https://api.github.com/repos/andrerom/FOSHttpCache/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andrerom/FOSHttpCache/downloads","issues_url":"https://api.github.com/repos/andrerom/FOSHttpCache/issues{/number}","pulls_url":"https://api.github.com/repos/andrerom/FOSHttpCache/pulls{/number}","milestones_url":"https://api.github.com/repos/andrerom/FOSHttpCache/milestones{/number}","notifications_url":"https://api.github.com/repos/andrerom/FOSHttpCache/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andrerom/FOSHttpCache/labels{/name}","releases_url":"https://api.github.com/repos/andrerom/FOSHttpCache/releases{/id}","deployments_url":"https://api.github.com/repos/andrerom/FOSHttpCache/deployments","created_at":"2015-08-09T23:46:33Z","updated_at":"2015-08-09T23:46:34Z","pushed_at":"2018-03-12T10:48:17Z","git_url":"git://github.com/andrerom/FOSHttpCache.git","ssh_url":"git@github.com:andrerom/FOSHttpCache.git","clone_url":"https://github.com/andrerom/FOSHttpCache.git","svn_url":"https://github.com/andrerom/FOSHttpCache","homepage":"http://foshttpcache.readthedocs.org/","size":1175,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"FriendsOfSymfony:master","ref":"master","sha":"b9ca77ef8d90ac92c923c93a8db8282ea02ee319","user":{"login":"FriendsOfSymfony","id":529709,"avatar_url":"https://avatars1.githubusercontent.com/u/529709?v=4","gravatar_id":"","url":"https://api.github.com/users/FriendsOfSymfony","html_url":"https://github.com/FriendsOfSymfony","followers_url":"https://api.github.com/users/FriendsOfSymfony/followers","following_url":"https://api.github.com/users/FriendsOfSymfony/following{/other_user}","gists_url":"https://api.github.com/users/FriendsOfSymfony/gists{/gist_id}","starred_url":"https://api.github.com/users/FriendsOfSymfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FriendsOfSymfony/subscriptions","organizations_url":"https://api.github.com/users/FriendsOfSymfony/orgs","repos_url":"https://api.github.com/users/FriendsOfSymfony/repos","events_url":"https://api.github.com/users/FriendsOfSymfony/events{/privacy}","received_events_url":"https://api.github.com/users/FriendsOfSymfony/received_events","type":"Organization","site_admin":false},"repo":{"id":16147914,"name":"FOSHttpCache","full_name":"FriendsOfSymfony/FOSHttpCache","owner":{"login":"FriendsOfSymfony","id":529709,"avatar_url":"https://avatars1.githubusercontent.com/u/529709?v=4","gravatar_id":"","url":"https://api.github.com/users/FriendsOfSymfony","html_url":"https://github.com/FriendsOfSymfony","followers_url":"https://api.github.com/users/FriendsOfSymfony/followers","following_url":"https://api.github.com/users/FriendsOfSymfony/following{/other_user}","gists_url":"https://api.github.com/users/FriendsOfSymfony/gists{/gist_id}","starred_url":"https://api.github.com/users/FriendsOfSymfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FriendsOfSymfony/subscriptions","organizations_url":"https://api.github.com/users/FriendsOfSymfony/orgs","repos_url":"https://api.github.com/users/FriendsOfSymfony/repos","events_url":"https://api.github.com/users/FriendsOfSymfony/events{/privacy}","received_events_url":"https://api.github.com/users/FriendsOfSymfony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FriendsOfSymfony/FOSHttpCache","description":"Integrate your PHP application with your HTTP caching proxy","fork":false,"url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache","forks_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/forks","keys_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/teams","hooks_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/hooks","issue_events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/events{/number}","events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/events","assignees_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/assignees{/user}","branches_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/branches{/branch}","tags_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/tags","blobs_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/git/refs{/sha}","trees_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/statuses/{sha}","languages_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/languages","stargazers_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/stargazers","contributors_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/contributors","subscribers_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/subscribers","subscription_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/subscription","commits_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/commits{/sha}","git_commits_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/git/commits{/sha}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/comments{/number}","issue_comment_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/comments{/number}","contents_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/contents/{+path}","compare_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/merges","archive_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/downloads","issues_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues{/number}","pulls_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls{/number}","milestones_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/milestones{/number}","notifications_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/labels{/name}","releases_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/releases{/id}","deployments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/deployments","created_at":"2014-01-22T18:19:17Z","updated_at":"2018-03-12T10:20:02Z","pushed_at":"2018-03-12T10:48:19Z","git_url":"git://github.com/FriendsOfSymfony/FOSHttpCache.git","ssh_url":"git@github.com:FriendsOfSymfony/FOSHttpCache.git","clone_url":"https://github.com/FriendsOfSymfony/FOSHttpCache.git","svn_url":"https://github.com/FriendsOfSymfony/FOSHttpCache","homepage":"https://foshttpcache.readthedocs.io","size":1150,"stargazers_count":177,"watchers_count":177,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":41,"open_issues":13,"watchers":177,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/332"},"html":{"href":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/332"},"issue":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/332"},"comments":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/332/comments"},"review_comments":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/332/comments"},"review_comment":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/332/commits"},"statuses":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/statuses/ebc0fa454102f676e34af251e2540059a2ca39ff"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"andrerom"}}