Question 22
Consider the following python code snippet. Assuming proper configuration for caching is done, answer the question below.
from flask import Flask, requestfrom flask_caching import Cacheimport time
app = Flask(__name__)
app.config['CACHE_TYPE'] = 'RedisCache'app.config['CACHE_DEFAULT_TIMEOUT'] = 5cache = Cache(app)
@app.route('/time')@cache.cached()def get_time(): return str(time.time())Suppose the following sequence of requests is made:
Request 1: GET /time at 00:00:00
Request 2: GET /time at 00:00:02
Request 3: GET /time at 00:00:06
What will the responses be for each request?