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

key_prefix parameter disregarded when query_string is set to True #165

Closed
avishavit opened this issue Mar 26, 2020 · 3 comments
Closed

key_prefix parameter disregarded when query_string is set to True #165

avishavit opened this issue Mar 26, 2020 · 3 comments

Comments

@avishavit
Copy link

Hi, I see in the code for the cached method that if query_string is True then the method that is called is make_cache_key_query_string that's in https://github.com/sh4nks/flask-caching/blob/b8e2fa6d3251dc60548751855d1d329eecef132a/flask_caching/__init__.py#L464
then params are hashed, request path is added and the cache key does not reflect the key_prefix parameter.
Apart from other issues like post body not included, this makes the library a bit of an effort to integrate.

Would appreciate help, thanks!

@sh4nks
Copy link
Collaborator

sh4nks commented May 31, 2020

When #159 is merged, you can provide your own make_cache_key functionality which I guess will solve this.

@sh4nks sh4nks closed this as completed May 31, 2020
@amitt001
Copy link

amitt001 commented Nov 30, 2020

@sh4nks Any technical reason for not adding prefix when query_string=True? I ran into this and it seemed like a bug to me.

@AndreLobato
Copy link

I've also ran into this. I don't see any reason why the _make_cache_key_query_string couldn't just be appended to the normal _make_cache_key function instead of doing this hard "if" clause.

https://github.com/sh4nks/flask-caching/blob/f1899bc4522e090d94f68092364002df92aff49a/flask_caching/__init__.py#L532-L536

the _make_cache_key_query_string is still useful as performs the args hashing, so I am happy to use, but I also need to add a custom key_prefix. Having both options not working together in the same function without errors or warnings seems like a bug to me as well I am happy to submit a PR for that if that's agreed as the expected behaviour.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants