Debian Codegraph @

docs/index.rst

raw
1 Flask-Caching
2 =============
3
4 .. module:: flask_caching
5 :noindex:
6
7 Flask-Caching is an extension to `Flask`_ that adds caching support for
8 various backends to any Flask application. By running on top of `cachelib`_
9 it supports all of `werkzeug`_'s original caching backends through a uniformed
10 API. It is also possible to develop your own caching backend by subclassing
11 :class:`.BaseCache` class.
12
13 .. code-block:: python
14
15 from flask import Flask
16 from flask_caching import Cache
17
18 app = Flask(__name__)
19 cache = Cache(app, config={"CACHE_TYPE": "SimpleCache"})
20
21 @app.route("/")
22 @cache.cached(timeout=50)
23 def index():
24 return "This response is cached for 50 seconds"
25
26
27 Installation
28 ------------
29
30 Install the extension with the following command::
31
32 $ pip install Flask-Caching
33
34 or alternatively with uv::
35
36 $ uv add Flask-Caching
37
38 Flask-Caching 2.5.0 supports Python 3.11+.
39
40
41 Content
42 -------
43
44 .. toctree::
45 :maxdepth: 2
46
47 quickstart
48 usage
49 configuration
50 backends
51 contrib-backends
52 serializers
53 custom-backends
54
55
56 API
57 ---
58
59 .. toctree::
60 :maxdepth: 2
61
62 api
63
64
65 Additional Information
66 ----------------------
67
68 .. toctree::
69 :maxdepth: 2
70
71 changelog
72 license
73
74 * :ref:`search`
75
76
77 .. _Flask: http://flask.pocoo.org/
78 .. _werkzeug: http://werkzeug.pocoo.org/
79 .. _cachelib: https://github.com/pallets/cachelib