{"action":"closed","issue":{"url":"https://api.github.com/repos/learning-unlimited/ESP-Website/issues/866","labels_url":"https://api.github.com/repos/learning-unlimited/ESP-Website/issues/866/labels{/name}","comments_url":"https://api.github.com/repos/learning-unlimited/ESP-Website/issues/866/comments","events_url":"https://api.github.com/repos/learning-unlimited/ESP-Website/issues/866/events","html_url":"https://github.com/learning-unlimited/ESP-Website/issues/866","id":24693862,"number":866,"title":"Argcache over-invalidating","user":{"login":"benjaminjkraft","id":111238,"avatar_url":"https://avatars.githubusercontent.com/u/111238?v=3","gravatar_id":"","url":"https://api.github.com/users/benjaminjkraft","html_url":"https://github.com/benjaminjkraft","followers_url":"https://api.github.com/users/benjaminjkraft/followers","following_url":"https://api.github.com/users/benjaminjkraft/following{/other_user}","gists_url":"https://api.github.com/users/benjaminjkraft/gists{/gist_id}","starred_url":"https://api.github.com/users/benjaminjkraft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjaminjkraft/subscriptions","organizations_url":"https://api.github.com/users/benjaminjkraft/orgs","repos_url":"https://api.github.com/users/benjaminjkraft/repos","events_url":"https://api.github.com/users/benjaminjkraft/events{/privacy}","received_events_url":"https://api.github.com/users/benjaminjkraft/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/learning-unlimited/ESP-Website/labels/Caching","name":"Caching","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2013-12-23T04:17:58Z","updated_at":"2015-11-14T03:40:52Z","closed_at":"2015-11-14T03:40:52Z","body":"Run the following in a shell_plus --print-sql (with a cleared cache):\r\n\r\n```\r\nu1=ESPUser.objects.get(username='benkraft')\r\nu2=ESPUser.objects.get(username='lua')\r\nTag.setTag(\"test\",target=u1,value=\"foo\")\r\nTag.setTag(\"test\",target=u2,value=\"bar\")\r\nTag.getTag(\"test\",target=u1) #runs a query as expected\r\nTag.getTag(\"test\",target=u1) #does not run a query as expected\r\nTag.getTag(\"test\",target=u2) #runs a query as expected\r\nTag.getTag(\"test\",target=u2) #does not run a query as expected\r\nTag.setTag(\"test\",target=u1,value=\"baz\")\r\nTag.getTag(\"test\",target=u1) #runs a query as expected\r\nTag.getTag(\"test\",target=u2) #runs a query that should be unnecessary\r\n```\r\n\r\nI'm fairly although not completely sure that this is not an issue with the application of argcache to tags, but rather an argcache bug.  ~~My guess is that what it's doing is seeing that a tag with one correct argument was updated, and expiring the cache, even though the other argument was not correct; that is, that when the tag with `name=\"test\"` and `target=u1` is updated, it expires all tags with `name=\"test\"` *or* `target=u1`, where it should be using an and, but I'm not entirely sure.  If that is in fact the bug, I claim it is a bug, since the other behavior can be accomplished by simply putting two `depend_on_row`s, but we should be careful changing it since it's possible existing code depends on it as such.~~\r\n\r\n~~(If we do think this is a bug we want to fix, something equivalent should probably get added to the argcache tests.)~~\r\n\r\nLooks like it happens with any cached function where the depend_on_row references some, but not all, of the arguments -- it will expire way more caches than it should. See the test test_depend_on_row_with_dummy in argcache's tests (currently in branch argcache-tests, #838)."}}