{"action":"created","comment":{"url":"https://api.github.com/repos/playframework/playframework/pulls/comments/152456327","pull_request_review_id":78321197,"id":152456327,"diff_hunk":"@@ -0,0 +1,116 @@\n+/*\n+ * Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com>\n+ */\n+package play.cache.caffeine;\n+\n+import com.github.benmanes.caffeine.cache.Caffeine;\n+import com.typesafe.config.Config;\n+\n+import java.util.Map;\n+import java.util.Objects;\n+import java.util.concurrent.TimeUnit;\n+\n+/**\n+ * A configuration parser for the {@link Caffeine} builder.\n+ * <p>\n+ * <ul>\n+ *   <li>{@code initial-capacity=[integer]}: sets {@link Caffeine#initialCapacity}.\n+ *   <li>{@code maximum-size=[long]}: sets {@link Caffeine#maximumSize}.\n+ *   <li>{@code maximum-weight=[memory-size]}: sets {@link Caffeine#maximumWeight}.\n+ *   <li>{@code expire-after-access=[duration]}: sets {@link Caffeine#expireAfterAccess}.\n+ *   <li>{@code expire-after-write=[duration]}: sets {@link Caffeine#expireAfterWrite}.\n+ *   <li>{@code refresh-after-write=[duration]}: sets {@link Caffeine#refreshAfterWrite}.\n+ *   <li>{@code weak-keys}=[condition]: sets {@link Caffeine#weakKeys}.\n+ *   <li>{@code weak-values}=[condition]: sets {@link Caffeine#weakValues}.\n+ *   <li>{@code soft-values}=[condition]: sets {@link Caffeine#softValues}.\n+ *   <li>{@code record-stats}=[condition]: sets {@link Caffeine#recordStats}.\n+ * </ul>\n+ * <p>\n+ * The maximum weight may be specified numerically or as a memory size. When set using a memory size\n+ * syntax the builder is set to the number of bytes.\n+ * <p>\n+ * It is illegal to use the following configurations together:\n+ * <ul>\n+ *   <li>{@code maximumSize} and {@code maximumWeight}\n+ *   <li>{@code weakValues} and {@code softValues} set to {@code true}\n+ * </ul>\n+ * <p>\n+ * {@code CaffeineParser} does not support configuring {@code Caffeine} methods with non-value\n+ * parameters. These must be configured in code.\n+ */\n+public final class CaffeineParser {\n+    private final Caffeine<Object, Object> cacheBuilder;\n+    private final Config config;\n+\n+    private CaffeineParser(Config config) {\n+        this.cacheBuilder = Caffeine.newBuilder();\n+        this.config = Objects.requireNonNull(config);\n+    }\n+\n+    /** Returns a configured {@link Caffeine} cache builder. */\n+    public static Caffeine<Object, Object> from(Config config) {\n+        CaffeineParser parser = new CaffeineParser(config);\n+\n+        config.entrySet().stream().map(Map.Entry::getKey).forEach(parser::parse);\n+\n+        return parser.cacheBuilder;\n+    }\n+\n+    @SuppressWarnings(\"fallthrough\")\n+    private void parse(String key) {\n+        switch (key) {\n+            case \"initial-capacity\":\n+                System.out.println(\"initial-capacity:\" + config.getInt(key));\n+                cacheBuilder.initialCapacity(config.getInt(key));\n+                break;\n+            case \"maximum-size\":\n+                System.out.println(\"maximum-size:\" + config.getLong(key));\n+                cacheBuilder.maximumSize(config.getLong(key));\n+                break;\n+            case \"maximum-weight\":\n+                System.out.println(\"maximum-weight:\" + config.getMemorySize(key));\n+                cacheBuilder.maximumWeight(config.getMemorySize(key).toBytes());\n+                break;\n+            case \"expire-after-access\":","path":"framework/src/play-caffeine-cache/src/main/java/play/cache/caffeine/CaffeineParser.java","position":74,"original_position":74,"commit_id":"ef3011d26035a728d0c6aa6f4f84acb13f23e61f","original_commit_id":"ef3011d26035a728d0c6aa6f4f84acb13f23e61f","user":{"login":"dusanstanojeviccs","id":15340338,"avatar_url":"https://avatars0.githubusercontent.com/u/15340338?v=4","gravatar_id":"","url":"https://api.github.com/users/dusanstanojeviccs","html_url":"https://github.com/dusanstanojeviccs","followers_url":"https://api.github.com/users/dusanstanojeviccs/followers","following_url":"https://api.github.com/users/dusanstanojeviccs/following{/other_user}","gists_url":"https://api.github.com/users/dusanstanojeviccs/gists{/gist_id}","starred_url":"https://api.github.com/users/dusanstanojeviccs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dusanstanojeviccs/subscriptions","organizations_url":"https://api.github.com/users/dusanstanojeviccs/orgs","repos_url":"https://api.github.com/users/dusanstanojeviccs/repos","events_url":"https://api.github.com/users/dusanstanojeviccs/events{/privacy}","received_events_url":"https://api.github.com/users/dusanstanojeviccs/received_events","type":"User","site_admin":false},"body":"Got it, I've removed: expire-after-access, expire-after-write, refreshAfterWrite.","created_at":"2017-11-22T02:39:21Z","updated_at":"2017-11-22T02:39:21Z","html_url":"https://github.com/playframework/playframework/pull/8025#discussion_r152456327","pull_request_url":"https://api.github.com/repos/playframework/playframework/pulls/8025","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/playframework/playframework/pulls/comments/152456327"},"html":{"href":"https://github.com/playframework/playframework/pull/8025#discussion_r152456327"},"pull_request":{"href":"https://api.github.com/repos/playframework/playframework/pulls/8025"}},"in_reply_to_id":152391750},"pull_request":{"url":"https://api.github.com/repos/playframework/playframework/pulls/8025","id":153819555,"html_url":"https://github.com/playframework/playframework/pull/8025","diff_url":"https://github.com/playframework/playframework/pull/8025.diff","patch_url":"https://github.com/playframework/playframework/pull/8025.patch","issue_url":"https://api.github.com/repos/playframework/playframework/issues/8025","number":8025,"state":"open","locked":false,"title":"Added Caffeine Cache module and made it the default Cache","user":{"login":"dusanstanojeviccs","id":15340338,"avatar_url":"https://avatars0.githubusercontent.com/u/15340338?v=4","gravatar_id":"","url":"https://api.github.com/users/dusanstanojeviccs","html_url":"https://github.com/dusanstanojeviccs","followers_url":"https://api.github.com/users/dusanstanojeviccs/followers","following_url":"https://api.github.com/users/dusanstanojeviccs/following{/other_user}","gists_url":"https://api.github.com/users/dusanstanojeviccs/gists{/gist_id}","starred_url":"https://api.github.com/users/dusanstanojeviccs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dusanstanojeviccs/subscriptions","organizations_url":"https://api.github.com/users/dusanstanojeviccs/orgs","repos_url":"https://api.github.com/users/dusanstanojeviccs/repos","events_url":"https://api.github.com/users/dusanstanojeviccs/events{/privacy}","received_events_url":"https://api.github.com/users/dusanstanojeviccs/received_events","type":"User","site_admin":false},"body":"# Pull Request Checklist\r\n\r\n* [x] Have you read [How to write the perfect pull request](https://github.com/blog/1943-how-to-write-the-perfect-pull-request)?\r\n* [x] Have you read through the [contributor guidelines](https://www.playframework.com/contributing)?\r\n* [x] Have you signed the [Lightbend CLA](https://www.lightbend.com/contribute/cla)?\r\n* [x] Have you referenced any issues you're fixing using [commit message keywords](https://help.github.com/articles/closing-issues-using-keywords/)?\r\n* [x] Have you added copyright headers to new files?\r\n* [x] Have you checked that both Scala and Java APIs are updated?\r\n* [x] Have you updated the documentation for both Scala and Java sections?\r\n* [x] Have you added tests for any changed functionality?\r\n\r\n# Helpful things\r\n\r\n## Fixes\r\n\r\nFixes #7974 \r\n\r\n## Purpose\r\n\r\nThis PR is adding Caffeine Cache module to Play and setting Caffeine Cache as the default cache provider.\r\n\r\n## Background Context\r\n\r\nI've mostly based this solution on previous Ehcache implementation.\r\n\r\n## References\r\n\r\nhttps://github.com/playframework/playframework/issues/7974\r\n","created_at":"2017-11-21T07:52:41Z","updated_at":"2017-11-22T02:39:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d95661bf77b14cd6472b4ee62e295c24f983193a","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/playframework/playframework/pulls/8025/commits","review_comments_url":"https://api.github.com/repos/playframework/playframework/pulls/8025/comments","review_comment_url":"https://api.github.com/repos/playframework/playframework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/playframework/playframework/issues/8025/comments","statuses_url":"https://api.github.com/repos/playframework/playframework/statuses/ef3011d26035a728d0c6aa6f4f84acb13f23e61f","head":{"label":"dusanstanojeviccs:master","ref":"master","sha":"ef3011d26035a728d0c6aa6f4f84acb13f23e61f","user":{"login":"dusanstanojeviccs","id":15340338,"avatar_url":"https://avatars0.githubusercontent.com/u/15340338?v=4","gravatar_id":"","url":"https://api.github.com/users/dusanstanojeviccs","html_url":"https://github.com/dusanstanojeviccs","followers_url":"https://api.github.com/users/dusanstanojeviccs/followers","following_url":"https://api.github.com/users/dusanstanojeviccs/following{/other_user}","gists_url":"https://api.github.com/users/dusanstanojeviccs/gists{/gist_id}","starred_url":"https://api.github.com/users/dusanstanojeviccs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dusanstanojeviccs/subscriptions","organizations_url":"https://api.github.com/users/dusanstanojeviccs/orgs","repos_url":"https://api.github.com/users/dusanstanojeviccs/repos","events_url":"https://api.github.com/users/dusanstanojeviccs/events{/privacy}","received_events_url":"https://api.github.com/users/dusanstanojeviccs/received_events","type":"User","site_admin":false},"repo":{"id":110208691,"name":"playframework","full_name":"dusanstanojeviccs/playframework","owner":{"login":"dusanstanojeviccs","id":15340338,"avatar_url":"https://avatars0.githubusercontent.com/u/15340338?v=4","gravatar_id":"","url":"https://api.github.com/users/dusanstanojeviccs","html_url":"https://github.com/dusanstanojeviccs","followers_url":"https://api.github.com/users/dusanstanojeviccs/followers","following_url":"https://api.github.com/users/dusanstanojeviccs/following{/other_user}","gists_url":"https://api.github.com/users/dusanstanojeviccs/gists{/gist_id}","starred_url":"https://api.github.com/users/dusanstanojeviccs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dusanstanojeviccs/subscriptions","organizations_url":"https://api.github.com/users/dusanstanojeviccs/orgs","repos_url":"https://api.github.com/users/dusanstanojeviccs/repos","events_url":"https://api.github.com/users/dusanstanojeviccs/events{/privacy}","received_events_url":"https://api.github.com/users/dusanstanojeviccs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dusanstanojeviccs/playframework","description":"Play Framework","fork":true,"url":"https://api.github.com/repos/dusanstanojeviccs/playframework","forks_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/forks","keys_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/teams","hooks_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/hooks","issue_events_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/issues/events{/number}","events_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/events","assignees_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/assignees{/user}","branches_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/branches{/branch}","tags_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/tags","blobs_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/git/refs{/sha}","trees_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/statuses/{sha}","languages_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/languages","stargazers_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/stargazers","contributors_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/contributors","subscribers_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/subscribers","subscription_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/subscription","commits_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/commits{/sha}","git_commits_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/git/commits{/sha}","comments_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/comments{/number}","issue_comment_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/issues/comments{/number}","contents_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/contents/{+path}","compare_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/merges","archive_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/downloads","issues_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/issues{/number}","pulls_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/pulls{/number}","milestones_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/milestones{/number}","notifications_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/labels{/name}","releases_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/releases{/id}","deployments_url":"https://api.github.com/repos/dusanstanojeviccs/playframework/deployments","created_at":"2017-11-10T05:57:23Z","updated_at":"2017-11-10T05:57:30Z","pushed_at":"2017-11-21T07:36:18Z","git_url":"git://github.com/dusanstanojeviccs/playframework.git","ssh_url":"git@github.com:dusanstanojeviccs/playframework.git","clone_url":"https://github.com/dusanstanojeviccs/playframework.git","svn_url":"https://github.com/dusanstanojeviccs/playframework","homepage":"http://www.playframework.com/","size":88152,"stargazers_count":0,"watchers_count":0,"language":"Scala","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,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"playframework:master","ref":"master","sha":"cdc2210758d906055774cd9573921d9cdfaaa106","user":{"login":"playframework","id":319107,"avatar_url":"https://avatars0.githubusercontent.com/u/319107?v=4","gravatar_id":"","url":"https://api.github.com/users/playframework","html_url":"https://github.com/playframework","followers_url":"https://api.github.com/users/playframework/followers","following_url":"https://api.github.com/users/playframework/following{/other_user}","gists_url":"https://api.github.com/users/playframework/gists{/gist_id}","starred_url":"https://api.github.com/users/playframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/playframework/subscriptions","organizations_url":"https://api.github.com/users/playframework/orgs","repos_url":"https://api.github.com/users/playframework/repos","events_url":"https://api.github.com/users/playframework/events{/privacy}","received_events_url":"https://api.github.com/users/playframework/received_events","type":"Organization","site_admin":false},"repo":{"id":2340549,"name":"playframework","full_name":"playframework/playframework","owner":{"login":"playframework","id":319107,"avatar_url":"https://avatars0.githubusercontent.com/u/319107?v=4","gravatar_id":"","url":"https://api.github.com/users/playframework","html_url":"https://github.com/playframework","followers_url":"https://api.github.com/users/playframework/followers","following_url":"https://api.github.com/users/playframework/following{/other_user}","gists_url":"https://api.github.com/users/playframework/gists{/gist_id}","starred_url":"https://api.github.com/users/playframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/playframework/subscriptions","organizations_url":"https://api.github.com/users/playframework/orgs","repos_url":"https://api.github.com/users/playframework/repos","events_url":"https://api.github.com/users/playframework/events{/privacy}","received_events_url":"https://api.github.com/users/playframework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/playframework/playframework","description":"Play Framework","fork":false,"url":"https://api.github.com/repos/playframework/playframework","forks_url":"https://api.github.com/repos/playframework/playframework/forks","keys_url":"https://api.github.com/repos/playframework/playframework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/playframework/playframework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/playframework/playframework/teams","hooks_url":"https://api.github.com/repos/playframework/playframework/hooks","issue_events_url":"https://api.github.com/repos/playframework/playframework/issues/events{/number}","events_url":"https://api.github.com/repos/playframework/playframework/events","assignees_url":"https://api.github.com/repos/playframework/playframework/assignees{/user}","branches_url":"https://api.github.com/repos/playframework/playframework/branches{/branch}","tags_url":"https://api.github.com/repos/playframework/playframework/tags","blobs_url":"https://api.github.com/repos/playframework/playframework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/playframework/playframework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/playframework/playframework/git/refs{/sha}","trees_url":"https://api.github.com/repos/playframework/playframework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/playframework/playframework/statuses/{sha}","languages_url":"https://api.github.com/repos/playframework/playframework/languages","stargazers_url":"https://api.github.com/repos/playframework/playframework/stargazers","contributors_url":"https://api.github.com/repos/playframework/playframework/contributors","subscribers_url":"https://api.github.com/repos/playframework/playframework/subscribers","subscription_url":"https://api.github.com/repos/playframework/playframework/subscription","commits_url":"https://api.github.com/repos/playframework/playframework/commits{/sha}","git_commits_url":"https://api.github.com/repos/playframework/playframework/git/commits{/sha}","comments_url":"https://api.github.com/repos/playframework/playframework/comments{/number}","issue_comment_url":"https://api.github.com/repos/playframework/playframework/issues/comments{/number}","contents_url":"https://api.github.com/repos/playframework/playframework/contents/{+path}","compare_url":"https://api.github.com/repos/playframework/playframework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/playframework/playframework/merges","archive_url":"https://api.github.com/repos/playframework/playframework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/playframework/playframework/downloads","issues_url":"https://api.github.com/repos/playframework/playframework/issues{/number}","pulls_url":"https://api.github.com/repos/playframework/playframework/pulls{/number}","milestones_url":"https://api.github.com/repos/playframework/playframework/milestones{/number}","notifications_url":"https://api.github.com/repos/playframework/playframework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/playframework/playframework/labels{/name}","releases_url":"https://api.github.com/repos/playframework/playframework/releases{/id}","deployments_url":"https://api.github.com/repos/playframework/playframework/deployments","created_at":"2011-09-07T09:24:08Z","updated_at":"2017-11-22T00:45:04Z","pushed_at":"2017-11-21T22:49:03Z","git_url":"git://github.com/playframework/playframework.git","ssh_url":"git@github.com:playframework/playframework.git","clone_url":"https://github.com/playframework/playframework.git","svn_url":"https://github.com/playframework/playframework","homepage":"http://www.playframework.com/","size":88158,"stargazers_count":9907,"watchers_count":9907,"language":"Scala","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3408,"mirror_url":null,"archived":false,"open_issues_count":319,"forks":3408,"open_issues":319,"watchers":9907,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/playframework/playframework/pulls/8025"},"html":{"href":"https://github.com/playframework/playframework/pull/8025"},"issue":{"href":"https://api.github.com/repos/playframework/playframework/issues/8025"},"comments":{"href":"https://api.github.com/repos/playframework/playframework/issues/8025/comments"},"review_comments":{"href":"https://api.github.com/repos/playframework/playframework/pulls/8025/comments"},"review_comment":{"href":"https://api.github.com/repos/playframework/playframework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/playframework/playframework/pulls/8025/commits"},"statuses":{"href":"https://api.github.com/repos/playframework/playframework/statuses/ef3011d26035a728d0c6aa6f4f84acb13f23e61f"}},"author_association":"NONE"}}
{"actor":{"display_login":"dusanstanojeviccs"}}