{"action":"opened","number":36,"pull_request":{"url":"https://api.github.com/repos/tkem/cachetools/pulls/36","id":33502963,"html_url":"https://github.com/tkem/cachetools/pull/36","diff_url":"https://github.com/tkem/cachetools/pull/36.diff","patch_url":"https://github.com/tkem/cachetools/pull/36.patch","issue_url":"https://api.github.com/repos/tkem/cachetools/issues/36","number":36,"state":"open","locked":false,"title":"Added helper functions to support fine grained control over the cache","user":{"login":"vladwing","id":2703642,"avatar_url":"https://avatars.githubusercontent.com/u/2703642?v=3","gravatar_id":"","url":"https://api.github.com/users/vladwing","html_url":"https://github.com/vladwing","followers_url":"https://api.github.com/users/vladwing/followers","following_url":"https://api.github.com/users/vladwing/following{/other_user}","gists_url":"https://api.github.com/users/vladwing/gists{/gist_id}","starred_url":"https://api.github.com/users/vladwing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladwing/subscriptions","organizations_url":"https://api.github.com/users/vladwing/orgs","repos_url":"https://api.github.com/users/vladwing/repos","events_url":"https://api.github.com/users/vladwing/events{/privacy}","received_events_url":"https://api.github.com/users/vladwing/received_events","type":"User","site_admin":false},"body":"Hi,\r\n\r\nI found usefull the following two cases for method calls, but I think they might be useful for function calls as well:\r\n1. Invalidating only one entry in the cache.\r\n2. Setting manually a cache entry, given the parameters of the method call\r\n\r\nHere is an example of how I see it being used:\r\n\r\n``` python\r\nclass Cached(object):\r\n    def __init__(self):\r\n        self._cache = LRUCache(maxsize=100)\r\n\r\n    @cachedmethod(operator.attrgetter('_cache'))\r\n    def get_id(self, id):\r\n        return expensive_call(uuid)\r\n\r\n    def set_id(self, id, value):\r\n        self.fast_get.cache_set(self, value, id)\r\n\r\n    def del_id(self, id):\r\n        self.fast_get.cache_invalidate(self, id)\r\n```\r\n\r\nTell me what you think, and I will update the function decorator as well, if you decide to merge my commit.\r\n\r\nCheers,\r\nVlad","created_at":"2015-04-16T23:34:21Z","updated_at":"2015-04-16T23:34:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tkem/cachetools/pulls/36/commits","review_comments_url":"https://api.github.com/repos/tkem/cachetools/pulls/36/comments","review_comment_url":"https://api.github.com/repos/tkem/cachetools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tkem/cachetools/issues/36/comments","statuses_url":"https://api.github.com/repos/tkem/cachetools/statuses/eb3226ad104b49185ef5383fae7690fd008f0b64","head":{"label":"vladwing:master","ref":"master","sha":"eb3226ad104b49185ef5383fae7690fd008f0b64","user":{"login":"vladwing","id":2703642,"avatar_url":"https://avatars.githubusercontent.com/u/2703642?v=3","gravatar_id":"","url":"https://api.github.com/users/vladwing","html_url":"https://github.com/vladwing","followers_url":"https://api.github.com/users/vladwing/followers","following_url":"https://api.github.com/users/vladwing/following{/other_user}","gists_url":"https://api.github.com/users/vladwing/gists{/gist_id}","starred_url":"https://api.github.com/users/vladwing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladwing/subscriptions","organizations_url":"https://api.github.com/users/vladwing/orgs","repos_url":"https://api.github.com/users/vladwing/repos","events_url":"https://api.github.com/users/vladwing/events{/privacy}","received_events_url":"https://api.github.com/users/vladwing/received_events","type":"User","site_admin":false},"repo":{"id":34085747,"name":"cachetools","full_name":"vladwing/cachetools","owner":{"login":"vladwing","id":2703642,"avatar_url":"https://avatars.githubusercontent.com/u/2703642?v=3","gravatar_id":"","url":"https://api.github.com/users/vladwing","html_url":"https://github.com/vladwing","followers_url":"https://api.github.com/users/vladwing/followers","following_url":"https://api.github.com/users/vladwing/following{/other_user}","gists_url":"https://api.github.com/users/vladwing/gists{/gist_id}","starred_url":"https://api.github.com/users/vladwing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladwing/subscriptions","organizations_url":"https://api.github.com/users/vladwing/orgs","repos_url":"https://api.github.com/users/vladwing/repos","events_url":"https://api.github.com/users/vladwing/events{/privacy}","received_events_url":"https://api.github.com/users/vladwing/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vladwing/cachetools","description":"Extensible memoizing collections and decorators","fork":true,"url":"https://api.github.com/repos/vladwing/cachetools","forks_url":"https://api.github.com/repos/vladwing/cachetools/forks","keys_url":"https://api.github.com/repos/vladwing/cachetools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vladwing/cachetools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vladwing/cachetools/teams","hooks_url":"https://api.github.com/repos/vladwing/cachetools/hooks","issue_events_url":"https://api.github.com/repos/vladwing/cachetools/issues/events{/number}","events_url":"https://api.github.com/repos/vladwing/cachetools/events","assignees_url":"https://api.github.com/repos/vladwing/cachetools/assignees{/user}","branches_url":"https://api.github.com/repos/vladwing/cachetools/branches{/branch}","tags_url":"https://api.github.com/repos/vladwing/cachetools/tags","blobs_url":"https://api.github.com/repos/vladwing/cachetools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vladwing/cachetools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vladwing/cachetools/git/refs{/sha}","trees_url":"https://api.github.com/repos/vladwing/cachetools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vladwing/cachetools/statuses/{sha}","languages_url":"https://api.github.com/repos/vladwing/cachetools/languages","stargazers_url":"https://api.github.com/repos/vladwing/cachetools/stargazers","contributors_url":"https://api.github.com/repos/vladwing/cachetools/contributors","subscribers_url":"https://api.github.com/repos/vladwing/cachetools/subscribers","subscription_url":"https://api.github.com/repos/vladwing/cachetools/subscription","commits_url":"https://api.github.com/repos/vladwing/cachetools/commits{/sha}","git_commits_url":"https://api.github.com/repos/vladwing/cachetools/git/commits{/sha}","comments_url":"https://api.github.com/repos/vladwing/cachetools/comments{/number}","issue_comment_url":"https://api.github.com/repos/vladwing/cachetools/issues/comments{/number}","contents_url":"https://api.github.com/repos/vladwing/cachetools/contents/{+path}","compare_url":"https://api.github.com/repos/vladwing/cachetools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vladwing/cachetools/merges","archive_url":"https://api.github.com/repos/vladwing/cachetools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vladwing/cachetools/downloads","issues_url":"https://api.github.com/repos/vladwing/cachetools/issues{/number}","pulls_url":"https://api.github.com/repos/vladwing/cachetools/pulls{/number}","milestones_url":"https://api.github.com/repos/vladwing/cachetools/milestones{/number}","notifications_url":"https://api.github.com/repos/vladwing/cachetools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vladwing/cachetools/labels{/name}","releases_url":"https://api.github.com/repos/vladwing/cachetools/releases{/id}","created_at":"2015-04-16T23:20:33Z","updated_at":"2015-04-16T23:24:30Z","pushed_at":"2015-04-16T23:24:29Z","git_url":"git://github.com/vladwing/cachetools.git","ssh_url":"git@github.com:vladwing/cachetools.git","clone_url":"https://github.com/vladwing/cachetools.git","svn_url":"https://github.com/vladwing/cachetools","homepage":"","size":500,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"tkem:master","ref":"master","sha":"1daf0c7d278de97745854ae1b9bc38999ddad6d8","user":{"login":"tkem","id":2833077,"avatar_url":"https://avatars.githubusercontent.com/u/2833077?v=3","gravatar_id":"","url":"https://api.github.com/users/tkem","html_url":"https://github.com/tkem","followers_url":"https://api.github.com/users/tkem/followers","following_url":"https://api.github.com/users/tkem/following{/other_user}","gists_url":"https://api.github.com/users/tkem/gists{/gist_id}","starred_url":"https://api.github.com/users/tkem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkem/subscriptions","organizations_url":"https://api.github.com/users/tkem/orgs","repos_url":"https://api.github.com/users/tkem/repos","events_url":"https://api.github.com/users/tkem/events{/privacy}","received_events_url":"https://api.github.com/users/tkem/received_events","type":"User","site_admin":false},"repo":{"id":18006791,"name":"cachetools","full_name":"tkem/cachetools","owner":{"login":"tkem","id":2833077,"avatar_url":"https://avatars.githubusercontent.com/u/2833077?v=3","gravatar_id":"","url":"https://api.github.com/users/tkem","html_url":"https://github.com/tkem","followers_url":"https://api.github.com/users/tkem/followers","following_url":"https://api.github.com/users/tkem/following{/other_user}","gists_url":"https://api.github.com/users/tkem/gists{/gist_id}","starred_url":"https://api.github.com/users/tkem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkem/subscriptions","organizations_url":"https://api.github.com/users/tkem/orgs","repos_url":"https://api.github.com/users/tkem/repos","events_url":"https://api.github.com/users/tkem/events{/privacy}","received_events_url":"https://api.github.com/users/tkem/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tkem/cachetools","description":"Extensible memoizing collections and decorators","fork":false,"url":"https://api.github.com/repos/tkem/cachetools","forks_url":"https://api.github.com/repos/tkem/cachetools/forks","keys_url":"https://api.github.com/repos/tkem/cachetools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tkem/cachetools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tkem/cachetools/teams","hooks_url":"https://api.github.com/repos/tkem/cachetools/hooks","issue_events_url":"https://api.github.com/repos/tkem/cachetools/issues/events{/number}","events_url":"https://api.github.com/repos/tkem/cachetools/events","assignees_url":"https://api.github.com/repos/tkem/cachetools/assignees{/user}","branches_url":"https://api.github.com/repos/tkem/cachetools/branches{/branch}","tags_url":"https://api.github.com/repos/tkem/cachetools/tags","blobs_url":"https://api.github.com/repos/tkem/cachetools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tkem/cachetools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tkem/cachetools/git/refs{/sha}","trees_url":"https://api.github.com/repos/tkem/cachetools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tkem/cachetools/statuses/{sha}","languages_url":"https://api.github.com/repos/tkem/cachetools/languages","stargazers_url":"https://api.github.com/repos/tkem/cachetools/stargazers","contributors_url":"https://api.github.com/repos/tkem/cachetools/contributors","subscribers_url":"https://api.github.com/repos/tkem/cachetools/subscribers","subscription_url":"https://api.github.com/repos/tkem/cachetools/subscription","commits_url":"https://api.github.com/repos/tkem/cachetools/commits{/sha}","git_commits_url":"https://api.github.com/repos/tkem/cachetools/git/commits{/sha}","comments_url":"https://api.github.com/repos/tkem/cachetools/comments{/number}","issue_comment_url":"https://api.github.com/repos/tkem/cachetools/issues/comments{/number}","contents_url":"https://api.github.com/repos/tkem/cachetools/contents/{+path}","compare_url":"https://api.github.com/repos/tkem/cachetools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tkem/cachetools/merges","archive_url":"https://api.github.com/repos/tkem/cachetools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tkem/cachetools/downloads","issues_url":"https://api.github.com/repos/tkem/cachetools/issues{/number}","pulls_url":"https://api.github.com/repos/tkem/cachetools/pulls{/number}","milestones_url":"https://api.github.com/repos/tkem/cachetools/milestones{/number}","notifications_url":"https://api.github.com/repos/tkem/cachetools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tkem/cachetools/labels{/name}","releases_url":"https://api.github.com/repos/tkem/cachetools/releases{/id}","created_at":"2014-03-22T10:15:14Z","updated_at":"2015-03-09T11:30:25Z","pushed_at":"2015-04-16T23:34:22Z","git_url":"git://github.com/tkem/cachetools.git","ssh_url":"git@github.com:tkem/cachetools.git","clone_url":"https://github.com/tkem/cachetools.git","svn_url":"https://github.com/tkem/cachetools","homepage":"","size":500,"stargazers_count":13,"watchers_count":13,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":5,"forks":4,"open_issues":5,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tkem/cachetools/pulls/36"},"html":{"href":"https://github.com/tkem/cachetools/pull/36"},"issue":{"href":"https://api.github.com/repos/tkem/cachetools/issues/36"},"comments":{"href":"https://api.github.com/repos/tkem/cachetools/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/tkem/cachetools/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/tkem/cachetools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tkem/cachetools/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/tkem/cachetools/statuses/eb3226ad104b49185ef5383fae7690fd008f0b64"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":22,"deletions":0,"changed_files":1}}