{"action":"created","comment":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/comments/46942702","id":46942702,"diff_hunk":"@@ -0,0 +1,58 @@\n+<?php\n+\n+namespace FOS\\HttpCache\\Tag\\Manager;\n+\n+use FOS\\HttpCache\\Tag\\ManagerInterface;\n+use FOS\\HttpCache\\Tag\\StorageInterface;\n+use Symfony\\Component\\HttpFoundation\\Response;\n+use Symfony\\Component\\HttpKernel\\HttpCache\\Store;\n+use Symfony\\Component\\HttpFoundation\\HeaderBag;\n+use Symfony\\Component\\Filesystem\\Filesystem;\n+\n+/**\n+ * Tag manager for the Symfony HTTP Cache Proxy.\n+ */\n+class Symfony implements ManagerInterface\n+{\n+    /**\n+     * @var StorageInterface\n+     */\n+    private $tagStorage;\n+\n+    /**\n+     * @var Store\n+     */\n+    private $cacheStorage;\n+\n+    public function __construct(StorageInterface $tagStorage, Store $cacheStorage, Filesystem $filesystem = null)\n+    {\n+        $this->tagStorage = $tagStorage;\n+        $this->cacheStorage = $cacheStorage;\n+        $this->filesystem = $filesystem ?: new Filesystem();\n+    }\n+\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function invalidateTags(array $tags)\n+    {\n+        $digests = $this->tagStorage->getCacheIds($tags);\n+\n+        foreach ($digests as $cacheDigest) {\n+            $cachePath = $this->cacheStorage->getPath($cacheDigest);\n+\n+            $this->filesystem->remove($cachePath);\n+        }\n+\n+        // remove the tag directory\n+        $this->tagStorage->removeTags($tags);\n+    }\n+\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function tagCacheId(array $tags, $contentDigest, $lifetime)","path":"src/Tag/Manager/Symfony.php","position":54,"original_position":54,"commit_id":"76864332802092ffed4707b1407be2ce0970bb87","original_commit_id":"76864332802092ffed4707b1407be2ce0970bb87","user":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"body":"We discussed this as `tagResponse` and accepting the `Response` object, however it makes more sense to deal with extracting things from the Response in the TagSubscriber, which is coupled to the HTTP cache anyway. However we retain this method so as not to ensure that both invalidateTags and tagCacheID operate on the same tag storage.","created_at":"2015-12-08T11:37:16Z","updated_at":"2015-12-08T11:37:16Z","html_url":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/253#discussion_r46942702","pull_request_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/253","_links":{"self":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/comments/46942702"},"html":{"href":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/253#discussion_r46942702"},"pull_request":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/253"}}},"pull_request":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/253","id":52006918,"html_url":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/253","diff_url":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/253.diff","patch_url":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/253.patch","issue_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/253","number":253,"state":"open","locked":false,"title":"Tag Subscriber","user":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"body":"This PR adds a new HttpCache subscriber for tag invalidation, and a symlink based tag invalidation mechanisim.\r\n\r\n\r\n- Tag `Manager` handles creation and invalidation of tags.\r\n- Symlink based cache tagging via. `SymlinkManager` (as discussed in linked issue).\r\n- Possiblity both for remote purging and \"local\" purging (no external requests).\r\n\r\nTODO:\r\n\r\n- [ ] Finish writing the tests (remote purger)\r\n- [ ] Documentation\r\n- [ ] <strike>Handlng of dangling tags.</strike> is this required?\r\n- [x] Integrate with Symfony Proxy\r\n\r\nWould fix #251","created_at":"2015-11-27T15:44:51Z","updated_at":"2015-12-08T11:37:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"adee026e7534a970a786e25b8d6bdf0c17970a2e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/253/commits","review_comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/253/comments","review_comment_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/253/comments","statuses_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/statuses/76864332802092ffed4707b1407be2ce0970bb87","head":{"label":"dantleech:tag_subscriber","ref":"tag_subscriber","sha":"76864332802092ffed4707b1407be2ce0970bb87","user":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"repo":{"id":28627292,"name":"FOSHttpCache","full_name":"dantleech/FOSHttpCache","owner":{"login":"dantleech","id":530801,"avatar_url":"https://avatars.githubusercontent.com/u/530801?v=3","gravatar_id":"","url":"https://api.github.com/users/dantleech","html_url":"https://github.com/dantleech","followers_url":"https://api.github.com/users/dantleech/followers","following_url":"https://api.github.com/users/dantleech/following{/other_user}","gists_url":"https://api.github.com/users/dantleech/gists{/gist_id}","starred_url":"https://api.github.com/users/dantleech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantleech/subscriptions","organizations_url":"https://api.github.com/users/dantleech/orgs","repos_url":"https://api.github.com/users/dantleech/repos","events_url":"https://api.github.com/users/dantleech/events{/privacy}","received_events_url":"https://api.github.com/users/dantleech/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dantleech/FOSHttpCache","description":"Integrate your PHP application with your HTTP caching proxy","fork":true,"url":"https://api.github.com/repos/dantleech/FOSHttpCache","forks_url":"https://api.github.com/repos/dantleech/FOSHttpCache/forks","keys_url":"https://api.github.com/repos/dantleech/FOSHttpCache/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dantleech/FOSHttpCache/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dantleech/FOSHttpCache/teams","hooks_url":"https://api.github.com/repos/dantleech/FOSHttpCache/hooks","issue_events_url":"https://api.github.com/repos/dantleech/FOSHttpCache/issues/events{/number}","events_url":"https://api.github.com/repos/dantleech/FOSHttpCache/events","assignees_url":"https://api.github.com/repos/dantleech/FOSHttpCache/assignees{/user}","branches_url":"https://api.github.com/repos/dantleech/FOSHttpCache/branches{/branch}","tags_url":"https://api.github.com/repos/dantleech/FOSHttpCache/tags","blobs_url":"https://api.github.com/repos/dantleech/FOSHttpCache/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dantleech/FOSHttpCache/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dantleech/FOSHttpCache/git/refs{/sha}","trees_url":"https://api.github.com/repos/dantleech/FOSHttpCache/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dantleech/FOSHttpCache/statuses/{sha}","languages_url":"https://api.github.com/repos/dantleech/FOSHttpCache/languages","stargazers_url":"https://api.github.com/repos/dantleech/FOSHttpCache/stargazers","contributors_url":"https://api.github.com/repos/dantleech/FOSHttpCache/contributors","subscribers_url":"https://api.github.com/repos/dantleech/FOSHttpCache/subscribers","subscription_url":"https://api.github.com/repos/dantleech/FOSHttpCache/subscription","commits_url":"https://api.github.com/repos/dantleech/FOSHttpCache/commits{/sha}","git_commits_url":"https://api.github.com/repos/dantleech/FOSHttpCache/git/commits{/sha}","comments_url":"https://api.github.com/repos/dantleech/FOSHttpCache/comments{/number}","issue_comment_url":"https://api.github.com/repos/dantleech/FOSHttpCache/issues/comments{/number}","contents_url":"https://api.github.com/repos/dantleech/FOSHttpCache/contents/{+path}","compare_url":"https://api.github.com/repos/dantleech/FOSHttpCache/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dantleech/FOSHttpCache/merges","archive_url":"https://api.github.com/repos/dantleech/FOSHttpCache/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dantleech/FOSHttpCache/downloads","issues_url":"https://api.github.com/repos/dantleech/FOSHttpCache/issues{/number}","pulls_url":"https://api.github.com/repos/dantleech/FOSHttpCache/pulls{/number}","milestones_url":"https://api.github.com/repos/dantleech/FOSHttpCache/milestones{/number}","notifications_url":"https://api.github.com/repos/dantleech/FOSHttpCache/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dantleech/FOSHttpCache/labels{/name}","releases_url":"https://api.github.com/repos/dantleech/FOSHttpCache/releases{/id}","created_at":"2014-12-30T10:46:08Z","updated_at":"2014-12-30T10:46:09Z","pushed_at":"2015-12-08T11:33:37Z","git_url":"git://github.com/dantleech/FOSHttpCache.git","ssh_url":"git@github.com:dantleech/FOSHttpCache.git","clone_url":"https://github.com/dantleech/FOSHttpCache.git","svn_url":"https://github.com/dantleech/FOSHttpCache","homepage":"http://foshttpcache.readthedocs.org/","size":789,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"FriendsOfSymfony:master","ref":"master","sha":"37eddf009d54036a5ad3f9ef9c74b2a52a51c76f","user":{"login":"FriendsOfSymfony","id":529709,"avatar_url":"https://avatars.githubusercontent.com/u/529709?v=3","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://avatars.githubusercontent.com/u/529709?v=3","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}","created_at":"2014-01-22T18:19:17Z","updated_at":"2015-11-24T03:03:30Z","pushed_at":"2015-12-08T11:33:37Z","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":"http://foshttpcache.readthedocs.org/","size":987,"stargazers_count":117,"watchers_count":117,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":19,"forks":24,"open_issues":19,"watchers":117,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/253"},"html":{"href":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/253"},"issue":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/253"},"comments":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/253/comments"},"review_comments":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/253/comments"},"review_comment":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/253/commits"},"statuses":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/statuses/76864332802092ffed4707b1407be2ce0970bb87"}}}}