--- id: flask-caching version: "2.4.1" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # Flask-Caching — Adds caching support to Flask applications. License: permissive · Maintenance: active · Downloads: 10.1M/mo ## What it is and what it does Flask-Caching is a community-maintained fork of Flask-Cache that provides a decorator-based caching layer for Flask applications. It sits between your Flask routes and view logic, allowing you to cache expensive computations, database queries, or entire HTTP responses with minimal code changes. The package abstracts away the complexity of managing different cache backends—you configure a backend (simple in-memory, Redis, Memcached, filesystem, or others) once, then use decorators to mark functions for caching. The package depends only on flask and cachelib, keeping the install footprint small. It's actively maintained by the Pallets Community Ecosystem (the organization behind Flask itself), with recent releases and no known security vulnerabilities. It supports current Python versions (3.10+) and is classified as production-stable. Use it for: - Cache expensive database queries in view functions to reduce load and improve response times. - Cache rendered templates or partial HTML fragments to avoid re-rendering on every request. - Memoize the results of slow computations or API calls with automatic expiration. - Implement request-level or application-level caching strategies without writing backend-specific code. - Add cache invalidation logic to clear cached data when underlying data changes. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Flask-Caching adds caching support to Flask applications, allowing you to cache view functions, templates, and arbitrary data using multiple backend storage options. Yes. Flask-Caching is a mature, actively maintained package with low install friction, no security issues, and a permissive license. It's the standard way to add caching to Flask applications and is backed by the Pallets organization. Install it if you need to cache view functions, templates, or arbitrary data in a Flask app. ## Install pip install flask-caching uv add flask-caching poetry add flask-caching ## Installing Flask-Caching Before you install: Low friction install with only two runtime dependencies (flask and cachelib). The project is actively maintained under the Pallets Community Ecosystem with a recent release and ongoing repository activity. License in practice: BSD-3-Clause is a permissive license; you can use this package freely in commercial and private projects with minimal restrictions, provided you include the license text. Quickstart: pip install flask-caching from flask import Flask from flask_caching import Cache app = Flask(__name__) cache = Cache(app, config={'CACHE_TYPE': 'simple'}) @app.route('/data') @cache.cached() def get_data(): return {'result': 'cached'} Requires Python 3.10 or later. Verify before relying: - Whether all advertised cache backends (Redis, Memcached, filesystem, etc.) are included or require separate installation. - Performance characteristics and cache hit/miss overhead compared to direct backend usage. - Default cache timeout values and expiration behavior for decorated functions. ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 10.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags flask caching decorator, cache flask views, flask application cache, http response caching flask, flask cache backends, memoization flask, cache management flask, caching, performance-optimization, flask-extension [View on SkillFed](https://skillfed.io/packages/flask-caching) · [View on PyPI](https://pypi.org/project/flask-caching/)