johnny-cache icon indicating copy to clipboard operation
johnny-cache copied to clipboard

Don't return the wrong cached value if parameters happen to be prefixes

Open Wilfred opened this issue 12 years ago • 0 comments

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.

Wilfred avatar Jan 22 '14 11:01 Wilfred