{"action":"opened","issue":{"url":"https://api.github.com/repos/mewna/catnip/issues/123","repository_url":"https://api.github.com/repos/mewna/catnip","labels_url":"https://api.github.com/repos/mewna/catnip/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/mewna/catnip/issues/123/comments","events_url":"https://api.github.com/repos/mewna/catnip/issues/123/events","html_url":"https://github.com/mewna/catnip/issues/123","id":391318903,"node_id":"MDU6SXNzdWUzOTEzMTg5MDM=","number":123,"title":"Add utility method to search the cache without creating a full copy","user":{"login":"natanbc","id":22461307,"node_id":"MDQ6VXNlcjIyNDYxMzA3","avatar_url":"https://avatars1.githubusercontent.com/u/22461307?v=4","gravatar_id":"","url":"https://api.github.com/users/natanbc","html_url":"https://github.com/natanbc","followers_url":"https://api.github.com/users/natanbc/followers","following_url":"https://api.github.com/users/natanbc/following{/other_user}","gists_url":"https://api.github.com/users/natanbc/gists{/gist_id}","starred_url":"https://api.github.com/users/natanbc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natanbc/subscriptions","organizations_url":"https://api.github.com/users/natanbc/orgs","repos_url":"https://api.github.com/users/natanbc/repos","events_url":"https://api.github.com/users/natanbc/events{/privacy}","received_events_url":"https://api.github.com/users/natanbc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-15T00:04:48Z","updated_at":"2018-12-15T00:04:48Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Currently, searching the cache for an entity matching an arbitrary filter (not id) requires [a full copy](https://github.com/mewna/catnip/blob/63eabf1378adebc5af91991a0095ce4446440ddb/src/main/java/com/mewna/catnip/cache/MemoryEntityCache.java#L435-L448), which may be undesirable. Since all caches are [thread safe](https://github.com/mewna/catnip/blob/63eabf1378adebc5af91991a0095ce4446440ddb/src/main/java/com/mewna/catnip/cache/MemoryEntityCache.java#L72-L87), it would be possible to add methods that find based on a provided Predicate, returning the matched entities.\r\n\r\nFor example:\r\n```java\r\nList<Member> findMembers(String guildId, Predicate<Member> filter);\r\n\r\nList<Member> findMembersByName(String guildId, String name, boolean ignoreCase);\r\n\r\nList<User> findUsers(Predicate<User> filter);\r\n\r\nList<User> findUsersByName(String name, boolean ignoreCase);\r\n```\r\n\r\nSimilar methods would also be created for other types of entities."}}
{"actor":{"display_login":"natanbc"}}