CACHE_TYPE flask

from flask import Flask
from flask_caching import Cache

app = Flask(__name__)

# Configuration for Flask-Caching extension
app.config['CACHE_TYPE'] = 'simple'  # Use a simple in-memory cache
app.config['CACHE_DEFAULT_TIMEOUT'] = 300  # Cache timeout in seconds

# Initialize Flask-Caching extension
cache = Cache(app)

# Define a route that utilizes caching
@app.route('/')
@cache.cached(timeout=60)  # Cache this route for 60 seconds
def index():
    return 'Hello, this response is cached for 60 seconds.'

if __name__ == '__main__':
    app.run(debug=True)