{"action":"closed","issue":{"url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/350","labels_url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/350/labels{/name}","comments_url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/350/comments","events_url":"https://api.github.com/repos/Raizlabs/DBFlow/issues/350/events","html_url":"https://github.com/Raizlabs/DBFlow/issues/350","id":99175222,"number":350,"title":"Model caching with String","user":{"login":"ndmt","id":5570328,"avatar_url":"https://avatars.githubusercontent.com/u/5570328?v=3","gravatar_id":"","url":"https://api.github.com/users/ndmt","html_url":"https://github.com/ndmt","followers_url":"https://api.github.com/users/ndmt/followers","following_url":"https://api.github.com/users/ndmt/following{/other_user}","gists_url":"https://api.github.com/users/ndmt/gists{/gist_id}","starred_url":"https://api.github.com/users/ndmt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndmt/subscriptions","organizations_url":"https://api.github.com/users/ndmt/orgs","repos_url":"https://api.github.com/users/ndmt/repos","events_url":"https://api.github.com/users/ndmt/events{/privacy}","received_events_url":"https://api.github.com/users/ndmt/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Raizlabs/DBFlow/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"agrosner","id":2117859,"avatar_url":"https://avatars.githubusercontent.com/u/2117859?v=3","gravatar_id":"","url":"https://api.github.com/users/agrosner","html_url":"https://github.com/agrosner","followers_url":"https://api.github.com/users/agrosner/followers","following_url":"https://api.github.com/users/agrosner/following{/other_user}","gists_url":"https://api.github.com/users/agrosner/gists{/gist_id}","starred_url":"https://api.github.com/users/agrosner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agrosner/subscriptions","organizations_url":"https://api.github.com/users/agrosner/orgs","repos_url":"https://api.github.com/users/agrosner/repos","events_url":"https://api.github.com/users/agrosner/events{/privacy}","received_events_url":"https://api.github.com/users/agrosner/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Raizlabs/DBFlow/milestones/17","html_url":"https://github.com/Raizlabs/DBFlow/milestones/2.3.0","labels_url":"https://api.github.com/repos/Raizlabs/DBFlow/milestones/17/labels","id":1186279,"number":17,"title":"2.3.0","description":null,"creator":{"login":"agrosner","id":2117859,"avatar_url":"https://avatars.githubusercontent.com/u/2117859?v=3","gravatar_id":"","url":"https://api.github.com/users/agrosner","html_url":"https://github.com/agrosner","followers_url":"https://api.github.com/users/agrosner/followers","following_url":"https://api.github.com/users/agrosner/following{/other_user}","gists_url":"https://api.github.com/users/agrosner/gists{/gist_id}","starred_url":"https://api.github.com/users/agrosner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agrosner/subscriptions","organizations_url":"https://api.github.com/users/agrosner/orgs","repos_url":"https://api.github.com/users/agrosner/repos","events_url":"https://api.github.com/users/agrosner/events{/privacy}","received_events_url":"https://api.github.com/users/agrosner/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":6,"state":"open","created_at":"2015-06-30T00:24:54Z","updated_at":"2015-11-29T16:41:27Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-08-05T10:35:08Z","updated_at":"2015-11-29T16:41:27Z","closed_at":"2015-11-29T16:41:27Z","body":"Hello,\r\n\r\nI would like to know if it is possible to implement a custom String based model caching class like that :\r\n\r\n    public class StringModelCaching<ModelClass extends Model> extends ModelCache<ModelClass,         LruCache<String, ModelClass>> {\r\n\r\n        public StringModelCaching(int size) {\r\n            super(new LruCache<String, ModelClass>(size));\r\n        }\r\n\r\n        @Override\r\n        public void addModel(Object id, ModelClass model) {\r\n            if(id instanceof String) {\r\n                synchronized (getCache()) {\r\n                    getCache().put(id.toString(), model);\r\n                }\r\n            } else {\r\n                throw new IllegalArgumentException(\"A ModelLruCache uses an String\");\r\n            }\r\n        }\r\n        ....\r\n    }\r\n\r\nBut I have some problems, for example : \r\n\r\n    new Select().from(Model.class).queryList();\r\n\r\nat com.raizlabs.android.dbflow.sql.SqlUtils.convertToCacheableList(SqlUtils.java:90)\r\nbecause of : \r\n    BaseCacheableModel cacheable = (BaseCacheableModel)modelCache.get(Long.valueOf(id));\r\n\r\nWith FlowQueryList there is no problem, but I don't know if I doing it well.. "}}