from flask import Blueprint, redirect, url_for, render_template from app import cache from datetime import datetime bp = Blueprint("app", __name__, url_prefix = "/") @bp.route("/") def index(): return redirect(url_for("topics.all_topics")) @bp.route("/cache-test") def cache_test(): test_value = cache.get('test') if test_value is None: test_value = 'cached_value_' + str(datetime.now()) cache.set('test', test_value, timeout=10) return f"set cache: {test_value}" return f"cached: {test_value}"