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

RedisCache now supports function as a key_prefix #109

Merged
merged 1 commit into from Oct 25, 2019

Conversation

alexdong
Copy link
Contributor

@alexdong alexdong commented May 1, 2019

It's quite useful to use a function, instead of a string, as the key_prefix. This is especially useful when we want the cache to be unique based on GET query parameters. For more details, please see https://stackoverflow.com/questions/14228985/what-does-key-prefix-do-for-flask-cache.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 80.179% when pulling bb26775 on happymoose:master into 9c10d7f on sh4nks:master.

3 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 80.179% when pulling bb26775 on happymoose:master into 9c10d7f on sh4nks:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 80.179% when pulling bb26775 on happymoose:master into 9c10d7f on sh4nks:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 80.179% when pulling bb26775 on happymoose:master into 9c10d7f on sh4nks:master.

@alexdong
Copy link
Contributor Author

alexdong commented May 1, 2019

I can see that Travis is complaining about failed tests for pypy but those are memcached related.

@@ -226,14 +226,14 @@ def make_cache(self, request):
else:
host = redis.Redis()

c = backends.RedisCache(host=host, key_prefix="werkzeug-test-case:")
c = backends.RedisCache(host=host, key_prefix=lambda: "werkzeug-test-case:")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add another test case which tests the key_prefix as a function instead of changing this test case.

@sh4nks sh4nks merged commit bb26775 into pallets-eco:master Oct 25, 2019
sh4nks added a commit that referenced this pull request Oct 25, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants