我只是想知道使用 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)