{"action":"opened","issue":{"url":"https://api.github.com/repos/google/guava/issues/2442","repository_url":"https://api.github.com/repos/google/guava","labels_url":"https://api.github.com/repos/google/guava/issues/2442/labels{/name}","comments_url":"https://api.github.com/repos/google/guava/issues/2442/comments","events_url":"https://api.github.com/repos/google/guava/issues/2442/events","html_url":"https://github.com/google/guava/issues/2442","id":145644164,"number":2442,"title":"Misleading javadoc of CacheBuilder","user":{"login":"vermahim","id":6451058,"avatar_url":"https://avatars.githubusercontent.com/u/6451058?v=3","gravatar_id":"","url":"https://api.github.com/users/vermahim","html_url":"https://github.com/vermahim","followers_url":"https://api.github.com/users/vermahim/followers","following_url":"https://api.github.com/users/vermahim/following{/other_user}","gists_url":"https://api.github.com/users/vermahim/gists{/gist_id}","starred_url":"https://api.github.com/users/vermahim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vermahim/subscriptions","organizations_url":"https://api.github.com/users/vermahim/orgs","repos_url":"https://api.github.com/users/vermahim/repos","events_url":"https://api.github.com/users/vermahim/events{/privacy}","received_events_url":"https://api.github.com/users/vermahim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-04T10:29:58Z","updated_at":"2016-04-04T10:29:58Z","closed_at":null,"body":"Hi,\r\n\r\n[Javadoc](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/cache/CacheBuilder.html) of CacheBuilder says it uses LRU as eviction policy, but my test says otherwise..\r\n\r\n`private static void testCacheEvictionPolicy() throws JsonProcessingException {\r\n        int maxSz = 3;\r\n        LoadingCache<Integer, Integer> cache = CacheBuilder.newBuilder().maximumSize(maxSz).build(new CacheLoader<Integer, Integer>() {\r\n            @Override\r\n            public Integer load(Integer integer) throws Exception {\r\n                return integer;\r\n            }\r\n        });\r\n        callCache(cache, 3);\r\n        printCache(cache);\r\n        for (int i = 0; i < 1000; i++) {\r\n            callCache(cache, 1);\r\n        }\r\n        callCache(cache, 4);\r\n        printCache(cache);\r\n    }\r\n\r\n    private static void callCache(LoadingCache<Integer, Integer> cache, int n) {\r\n        for (int i = 1; i <= n; i++) {\r\n            try {\r\n                cache.get(i);\r\n            } catch (ExecutionException e) {\r\n                throw new RuntimeException(e);\r\n            }\r\n        }\r\n\r\n    }\r\n\r\n    private static void printCache(LoadingCache<Integer, Integer> cache) {\r\n        System.out.println(\"cache begin\");\r\n        for (Map.Entry<Integer, Integer> entry : cache.asMap().entrySet()) {\r\n            System.out.println(entry.getKey() + \" : \" + entry.getValue());\r\n        }\r\n        System.out.println(\"cache end\");\r\n    }`\r\n\r\noutput:\r\n\r\n> cache begin\r\n> 3 : 3\r\n> 2 : 2\r\n> 1 : 1\r\n> cache end\r\n> cache begin\r\n> 3 : 3\r\n> 2 : 2\r\n> 4 : 4\r\n> cache end\r\n\r\n\r\n"}}