Flask-Caching is an extension to Flask that adds caching support for various backends to any Flask application. By running on top of cachelib it supports all of werkzeug’s original caching backends through a uniformed API. It is also possible to develop your own caching backend by subclassing flask_caching.backends.base.BaseCache class. Flask’s pluggable view classes are also supported. To cache them, use the same cached() decorator on the dispatch_request method. Using the same @cached decorator you are able to cache the result of other non-view related functions. The only stipulation is that you replace the key_prefix, otherwise it will use the request.path cache_key. Keys control what should be fetched from the cache. If, for example, a key does not exist in the cache, a new key-value entry will be created in the cache. Otherwise, the value (i.e. the cached result) of the key will be returned.

Features

  • Since 1.8, Flask-Caching supports only Python 3.5+
  • Cache is managed through a Cache instance
  • To cache view functions you will use the cached() decorator
  • Caching Pluggable View Classes
  • Flask’s pluggable view classes are also supported
  • In memoization, the functions arguments are also included into the cache_key

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow Flask-Caching

Flask-Caching Web Site

Other Useful Business Software
Our Free Plans just got better! | Auth0 Icon
Our Free Plans just got better! | Auth0

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your security. Auth0 now, thank yourself later.
Try free now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Flask-Caching!

Additional Project Details

Programming Language

Python

Related Categories

Python Frameworks, Python Web Development Software

Registered

2022-11-10