The flask-cache extension has a @cache.memoize
decorator to cache a view including the view's *args
and **kwargs
. Some of my views however take a URL query string as well, for example /foo/image?width=640
. The decorator adds a make_cache_key
method to the decorated view function that can be used to customise the cache key
However I do not know how to get the request.args
outside of the normal request context.
Any ideas how to make the @cache.memoize
work with URL query strings as well?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…