Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Wilfred
Copy link
Contributor

@Wilfred Wilfred commented Jan 22, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant