Question 31
Consider the below flask application.
app.py:
from flask import Flaskfrom flask_caching import Cachefrom time import sleep
config = { "CACHE_TYPE": "RedisCache", "CACHE_REDIS_URL": 'redis://localhost:6379/1'}
app = Flask(__name__)app.config.from_mapping(config)cache = Cache(app)
@cache.memoize(timeout=120)def get_score(name): sleep(10) return 0
@app.route('/match/<int:match_id>/player/<name>/score')def score(match_id, name): score = get_score(name) return f"IND Vs AUS- SKY: {score}"
if __name__ == '__main__': app.run(debug=True)If the Redis server is running on “localhost:6379”, and application is running on “http://127.0.0.1:5000”. If a user visits the URL “http://127.0.0.1:5000/match/1/player/sky/score” at 7AM in the morning for the first time and then at 9AM for the second time. What will be the approximate absolute difference between the response time of the requests?
10 seconds
0 seconds
20 seconds
120 Seconds