Question 24
Consider the below flask application.
from flask import Flaskfrom flask_caching import Cachefrom time import sleep
config = { "CACHE_TYPE": "SimpleCache", "CACHE_DEFAULT_TIMEOUT": 180}
app = Flask(__name__)app.config.from_mapping(config)cache = Cache(app)
@cache.memoize(timeout=180)def get_data(param): sleep(5) return f"Data for {param}"
@app.route('/data/<param>')def data(param): result = get_data(param) return f"Result: {result}"
if __name__ == '__main__': app.run(debug=True)If the application is running on “http://127.0.0.1:5000” and the user visits the URL “http://127.0.0.1:5000/data/test” three times in the following sequence:
1. First visit
2. Second visit after 2 minutes and 30 seconds
3. Third visit after 1 minute from the second visit
What will be the approximate difference in response times between the first and third requests?
5 seconds
0 seconds
10 seconds
180 seconds