Question 29
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 User visits the URL “http://127.0.0.1:5000/match/1/player/sky/score” first and then “http://127.0.0.1:5000/match/1/player/rohit/score” within 2 minutes. What will be the approximate absolute difference between the response time of the requests?
10 seconds
0 seconds
20 seconds
120 Seconds