johnny-cache
johnny-cache copied to clipboard
Don't return the wrong cached value if parameters happen to be prefixes
Johnny Cache builds a cache key by repeatedly calling key.update. This is equivalent to concatenating all the parameters together and generating a hash.
As a result, Johnny Cache confuses the following queries:
Foo.objects.get(x="foo", y="bar")
Foo.objects.get(x="foob", y="ar")
Bar.objects.get(x=1, y=21)
Bar.objects.get(x=12, y=1)
This pull request inserts a separator between parameters, so we don't get confused. This code is heavily based on the patch written by @milos-u.