Complete the code to import the caching extension in Flask.
from flask_caching import [1]
The correct class to import for Flask-Caching is Cache.
Complete the code to initialize caching with Flask app.
cache = [1](app)To initialize caching, create a Cache object passing the Flask app.
Fix the error in the decorator to cache the response for 60 seconds.
@cache.[1](timeout=60) def get_data(): return 'Hello, cached!'
The correct decorator method is cached to cache the function's response.
Fill both blanks to configure Flask-Caching with simple cache type and 300 seconds timeout.
app.config['CACHE_TYPE'] = '[1]' app.config['CACHE_DEFAULT_TIMEOUT'] = [2]
Use 'simple' for basic in-memory caching and set timeout to 300 seconds.
Fill all three blanks to create a cached route that returns JSON with a 120 seconds cache timeout.
@app.route('/data') @cache.[1](timeout=[2]) def data(): return [3]({'message': 'Hello, world!'})
The route uses the cached decorator with timeout 120 seconds and returns JSON using jsonify.
