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
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
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