You can use flask-caching
:
Continuation of the Flask-Cache Extension
With which you can do something like this:
@app.route("https://stackoverflow.com/")
@cache.cached(timeout=10, query_string=True)
def index():
return render_template('index.html')
Docs from source code:
:param query_string: Default False. When True, the cache key
used will be the result of hashing the
ordered query string parameters. This
avoids creating different caches for
the same query just because the parameters
were passed in a different order. See
_make_cache_key_query_string() for more
details.