我想知道在使用Flask-Caching时,响应是如何存储的以及存储在哪里。
例如:
例如:
from flask import Flask, request
from flask_caching import Cache
import datetime
app = Flask(__name__)
cache = Cache(app, config={'CACHE_TYPE': 'simple'})
def make_cache_key(*args, **kwargs):
return request.url
@app.route('/', methods=['GET'])
@cache.cached(timeout=50, key_prefix=make_cache_key)
def foo():
time = str(datetime.datetime.now()) + " " + str(request.url)
return time, 200
if __name__ == '__main__':
app.run(debug=True)