{"action":"created","comment":{"url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/pulls/comments/31757340","id":31757340,"diff_hunk":"@@ -0,0 +1,69 @@\n+<?php\n+/**\n+ * PHP-ActiveRecord-Components\n+ *\n+ * Useful common components for a php-activerecord based project\n+ *\n+ * @copyright   2013 One Mighty Roar\n+ * @link        http://onemightyroar.com\n+ */\n+\n+namespace OneMightyRoar\\PHP_ActiveRecord_Components\\Cache;\n+\n+use ActiveRecord\\Cache;\n+\n+/**\n+ * CacheInitializer\n+ *\n+ * Eases the setup of the PHP-ActiveRecord cache through a psuedo-factory,\n+ * allowing more type-safe initialization and compatibility\n+ *\n+ * @package OneMightyRoar\\PHP_ActiveRecord_Components\\Cache\n+ */\n+class CacheInitializer\n+{\n+\n+    /**\n+     * Constants\n+     */\n+\n+    /**\n+     * The option map key for the \"namespace\" option\n+     *\n+     * @type string\n+     */\n+    const OPTION_KEY_NAMESPACE = 'namespace';\n+\n+    /**\n+     * The option map key for the \"expire\" option\n+     *\n+     * @type string\n+     */\n+    const OPTION_KEY_EXPIRE = 'expire';\n+\n+\n+    /**\n+     * Methods\n+     */\n+\n+    /**\n+     * Statically initializes the global Cache adapter\n+     *\n+     * While the static global state is far from ideal, this provides pure compatibility\n+     * with AR's use of the cache implementation without a deep refactor or BC break\n+     *\n+     * @param CacheAdapterInterface $adapter The adapter to use for the cache\n+     * @param string $namespace An optional namespace to prefix all cache keys with\n+     * @param int $default_ttl The default expiry/TTL, in seconds, for each cache entry\n+     * @return void\n+     */\n+    public static function init(CacheAdapterInterface $adapter, $namespace = null, $default_ttl = null)\n+    {\n+        Cache::$adapter = $adapter;\n+\n+        Cache::$options = [\n+            static::OPTION_KEY_NAMESPACE => (string) $namespace,","path":"src/OneMightyRoar/PHP_ActiveRecord_Components/Cache/CacheInitializer.php","position":67,"original_position":65,"commit_id":"0826d9c97d0e795971ac19b286854ac79dd584e4","original_commit_id":"a96e96c70a508ca2b63100280d9d74be873fda58","user":{"login":"jstruzik","id":3697804,"avatar_url":"https://avatars.githubusercontent.com/u/3697804?v=3","gravatar_id":"","url":"https://api.github.com/users/jstruzik","html_url":"https://github.com/jstruzik","followers_url":"https://api.github.com/users/jstruzik/followers","following_url":"https://api.github.com/users/jstruzik/following{/other_user}","gists_url":"https://api.github.com/users/jstruzik/gists{/gist_id}","starred_url":"https://api.github.com/users/jstruzik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jstruzik/subscriptions","organizations_url":"https://api.github.com/users/jstruzik/orgs","repos_url":"https://api.github.com/users/jstruzik/repos","events_url":"https://api.github.com/users/jstruzik/events{/privacy}","received_events_url":"https://api.github.com/users/jstruzik/received_events","type":"User","site_admin":false},"body":"I guess you can troost.","created_at":"2015-06-04T19:40:36Z","updated_at":"2015-06-04T19:40:36Z","html_url":"https://github.com/onemightyroar/PHP-ActiveRecord-Components/pull/21#discussion_r31757340","pull_request_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/pulls/21","_links":{"self":{"href":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/pulls/comments/31757340"},"html":{"href":"https://github.com/onemightyroar/PHP-ActiveRecord-Components/pull/21#discussion_r31757340"},"pull_request":{"href":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/pulls/21","id":36966887,"html_url":"https://github.com/onemightyroar/PHP-ActiveRecord-Components/pull/21","diff_url":"https://github.com/onemightyroar/PHP-ActiveRecord-Components/pull/21.diff","patch_url":"https://github.com/onemightyroar/PHP-ActiveRecord-Components/pull/21.patch","issue_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/issues/21","number":21,"state":"open","locked":false,"title":"Feature - Cache interface","user":{"login":"Rican7","id":742384,"avatar_url":"https://avatars.githubusercontent.com/u/742384?v=3","gravatar_id":"","url":"https://api.github.com/users/Rican7","html_url":"https://github.com/Rican7","followers_url":"https://api.github.com/users/Rican7/followers","following_url":"https://api.github.com/users/Rican7/following{/other_user}","gists_url":"https://api.github.com/users/Rican7/gists{/gist_id}","starred_url":"https://api.github.com/users/Rican7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rican7/subscriptions","organizations_url":"https://api.github.com/users/Rican7/orgs","repos_url":"https://api.github.com/users/Rican7/repos","events_url":"https://api.github.com/users/Rican7/events{/privacy}","received_events_url":"https://api.github.com/users/Rican7/received_events","type":"User","site_admin":false},"body":"This PR introduces an interface to the [internal PHP-ActiveRecord cache adapter][phpactiverecord-cache-adapter] to allow for strong typing and documentation of the internal cache API.\r\n\r\nObviously, in order to work as intended, the interface was designed to match the current AR cache adapter invocation arguments.\r\n\r\nAlso, in order to make using the Cache as painless as possible, I've included 2 other classes:\r\n\r\n1. A `DoctrineCacheAdapter` to allow for a simple adaptation between Doctrine's **very** popular and common cache providers and the new interface here.\r\n2. A `CacheInitializer` static initializer class to simplify the setup of the AR cache through the new interfaces.\r\n\r\nIdeally AR would have had an interface defined for the cache adapter originally, but it doesn't. If one is ever defined, we can update this by including another adapter of sorts for BC.\r\n\r\n\r\n\r\n[phpactiverecord-cache-adapter]: https://github.com/jpfuentes2/php-activerecord/blob/b2ed6fc64ef35c88fd30d71091df0d0765719901/lib/Cache.php#L13","created_at":"2015-06-04T19:01:58Z","updated_at":"2015-06-04T19:40:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a2e22defb9fe8ee15ab5cb9f5e09f66b48f2f238","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/pulls/21/commits","review_comments_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/pulls/21/comments","review_comment_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/pulls/comments{/number}","comments_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/issues/21/comments","statuses_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/statuses/0826d9c97d0e795971ac19b286854ac79dd584e4","head":{"label":"Rican7:feature/cache-interface","ref":"feature/cache-interface","sha":"0826d9c97d0e795971ac19b286854ac79dd584e4","user":{"login":"Rican7","id":742384,"avatar_url":"https://avatars.githubusercontent.com/u/742384?v=3","gravatar_id":"","url":"https://api.github.com/users/Rican7","html_url":"https://github.com/Rican7","followers_url":"https://api.github.com/users/Rican7/followers","following_url":"https://api.github.com/users/Rican7/following{/other_user}","gists_url":"https://api.github.com/users/Rican7/gists{/gist_id}","starred_url":"https://api.github.com/users/Rican7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rican7/subscriptions","organizations_url":"https://api.github.com/users/Rican7/orgs","repos_url":"https://api.github.com/users/Rican7/repos","events_url":"https://api.github.com/users/Rican7/events{/privacy}","received_events_url":"https://api.github.com/users/Rican7/received_events","type":"User","site_admin":false},"repo":{"id":12763048,"name":"PHP-ActiveRecord-Components","full_name":"Rican7/PHP-ActiveRecord-Components","owner":{"login":"Rican7","id":742384,"avatar_url":"https://avatars.githubusercontent.com/u/742384?v=3","gravatar_id":"","url":"https://api.github.com/users/Rican7","html_url":"https://github.com/Rican7","followers_url":"https://api.github.com/users/Rican7/followers","following_url":"https://api.github.com/users/Rican7/following{/other_user}","gists_url":"https://api.github.com/users/Rican7/gists{/gist_id}","starred_url":"https://api.github.com/users/Rican7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rican7/subscriptions","organizations_url":"https://api.github.com/users/Rican7/orgs","repos_url":"https://api.github.com/users/Rican7/repos","events_url":"https://api.github.com/users/Rican7/events{/privacy}","received_events_url":"https://api.github.com/users/Rican7/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Rican7/PHP-ActiveRecord-Components","description":"","fork":true,"url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components","forks_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/forks","keys_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/teams","hooks_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/hooks","issue_events_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/issues/events{/number}","events_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/events","assignees_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/assignees{/user}","branches_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/branches{/branch}","tags_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/tags","blobs_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/git/refs{/sha}","trees_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/statuses/{sha}","languages_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/languages","stargazers_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/stargazers","contributors_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/contributors","subscribers_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/subscribers","subscription_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/subscription","commits_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/commits{/sha}","git_commits_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/git/commits{/sha}","comments_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/comments{/number}","issue_comment_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/issues/comments{/number}","contents_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/contents/{+path}","compare_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/merges","archive_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/downloads","issues_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/issues{/number}","pulls_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/pulls{/number}","milestones_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/milestones{/number}","notifications_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/labels{/name}","releases_url":"https://api.github.com/repos/Rican7/PHP-ActiveRecord-Components/releases{/id}","created_at":"2013-09-11T17:44:59Z","updated_at":"2015-01-22T22:02:28Z","pushed_at":"2015-06-04T19:28:13Z","git_url":"git://github.com/Rican7/PHP-ActiveRecord-Components.git","ssh_url":"git@github.com:Rican7/PHP-ActiveRecord-Components.git","clone_url":"https://github.com/Rican7/PHP-ActiveRecord-Components.git","svn_url":"https://github.com/Rican7/PHP-ActiveRecord-Components","homepage":null,"size":319,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"onemightyroar:master","ref":"master","sha":"4d4ec62507da69807fa426c6449a3b41e794293b","user":{"login":"onemightyroar","id":445001,"avatar_url":"https://avatars.githubusercontent.com/u/445001?v=3","gravatar_id":"","url":"https://api.github.com/users/onemightyroar","html_url":"https://github.com/onemightyroar","followers_url":"https://api.github.com/users/onemightyroar/followers","following_url":"https://api.github.com/users/onemightyroar/following{/other_user}","gists_url":"https://api.github.com/users/onemightyroar/gists{/gist_id}","starred_url":"https://api.github.com/users/onemightyroar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onemightyroar/subscriptions","organizations_url":"https://api.github.com/users/onemightyroar/orgs","repos_url":"https://api.github.com/users/onemightyroar/repos","events_url":"https://api.github.com/users/onemightyroar/events{/privacy}","received_events_url":"https://api.github.com/users/onemightyroar/received_events","type":"Organization","site_admin":false},"repo":{"id":9220784,"name":"PHP-ActiveRecord-Components","full_name":"onemightyroar/PHP-ActiveRecord-Components","owner":{"login":"onemightyroar","id":445001,"avatar_url":"https://avatars.githubusercontent.com/u/445001?v=3","gravatar_id":"","url":"https://api.github.com/users/onemightyroar","html_url":"https://github.com/onemightyroar","followers_url":"https://api.github.com/users/onemightyroar/followers","following_url":"https://api.github.com/users/onemightyroar/following{/other_user}","gists_url":"https://api.github.com/users/onemightyroar/gists{/gist_id}","starred_url":"https://api.github.com/users/onemightyroar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onemightyroar/subscriptions","organizations_url":"https://api.github.com/users/onemightyroar/orgs","repos_url":"https://api.github.com/users/onemightyroar/repos","events_url":"https://api.github.com/users/onemightyroar/events{/privacy}","received_events_url":"https://api.github.com/users/onemightyroar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/onemightyroar/PHP-ActiveRecord-Components","description":"","fork":false,"url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components","forks_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/forks","keys_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/teams","hooks_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/hooks","issue_events_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/issues/events{/number}","events_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/events","assignees_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/assignees{/user}","branches_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/branches{/branch}","tags_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/tags","blobs_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/git/refs{/sha}","trees_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/statuses/{sha}","languages_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/languages","stargazers_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/stargazers","contributors_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/contributors","subscribers_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/subscribers","subscription_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/subscription","commits_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/commits{/sha}","git_commits_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/git/commits{/sha}","comments_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/comments{/number}","issue_comment_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/issues/comments{/number}","contents_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/contents/{+path}","compare_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/merges","archive_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/downloads","issues_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/issues{/number}","pulls_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/pulls{/number}","milestones_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/milestones{/number}","notifications_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/labels{/name}","releases_url":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/releases{/id}","created_at":"2013-04-04T15:02:40Z","updated_at":"2015-04-14T21:56:01Z","pushed_at":"2015-06-04T19:28:13Z","git_url":"git://github.com/onemightyroar/PHP-ActiveRecord-Components.git","ssh_url":"git@github.com:onemightyroar/PHP-ActiveRecord-Components.git","clone_url":"https://github.com/onemightyroar/PHP-ActiveRecord-Components.git","svn_url":"https://github.com/onemightyroar/PHP-ActiveRecord-Components","homepage":null,"size":499,"stargazers_count":8,"watchers_count":8,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/pulls/21"},"html":{"href":"https://github.com/onemightyroar/PHP-ActiveRecord-Components/pull/21"},"issue":{"href":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/issues/21"},"comments":{"href":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/onemightyroar/PHP-ActiveRecord-Components/statuses/0826d9c97d0e795971ac19b286854ac79dd584e4"}}}}