Flask-Caching Documentation

Similar documents
Flask-Sitemap Documentation

Cassette Documentation

DoJSON Documentation. Release Invenio collaboration

monolith Documentation

PyWin32ctypes Documentation

Flask Gravatar. Release 0.5.0

Open Source Used In TSP

pyserial-asyncio Documentation

Preface. Audience. Cisco IOS Software Documentation. Organization

HALCoGen TMS570LS31x Help: example_sci_uart_9600.c

ProgressBar Abstract

Scott Auge

django-generic-filters Documentation

calio / form-input-nginx-module

About This Guide. and with the Cisco Nexus 1010 Virtual Services Appliance: N1K-C1010

spinnerchief Documentation Release 0.1.1

iwrite technical manual iwrite authors and contributors Revision: 0.00 (Draft/WIP)

Package fst. December 18, 2017

Static analysis for quality mobile applications

NemHandel Referenceklient 2.3.1

PageScope Box Operator Ver. 3.2 User s Guide

sptrans Documentation

MUMPS IO Documentation

openresty / encrypted-session-nginx-module

Ecma International Policy on Submission, Inclusion and Licensing of Software

MagicInfo Express Content Creator

LabVIEW Driver. User guide Version

Documentation Roadmap for Cisco Prime LAN Management Solution 4.2

Ecma International Policy on Submission, Inclusion and Licensing of Software

System Log NextAge Consulting Pete Halsted

Distinction Import Module User Guide. DISTINCTION.CO.UK

NemHandel Referenceklient 2.3.0

openresty / array-var-nginx-module

ANZ TRANSACTIVE MOBILE for ipad

RPly Documentation. Release Alex Gaynor

python-hl7 Documentation

Package fst. June 7, 2018

APPLICATION NOTE. Atmel AT03261: SAM D20 System Interrupt Driver (SYSTEM INTERRUPT) SAM D20 System Interrupt Driver (SYSTEM INTERRUPT)

Intel Stress Bitstreams and Encoder (Intel SBE) 2017 AVS2 Release Notes (Version 2.3)

ColdFusion Builder 3.2 Third Party Software Notices and/or Additional Terms and Conditions

SMS2CMDB Project Summary v1.6

Explaining & Accessing the SPDX License List

Ryft REST API - Swagger.io

AccuTerm 7 Internet Edition Connection Designer Help. Copyright Schellenbach & Assoc., Inc.

Open Source Used In Cisco Configuration Professional for Catalyst 1.0

AT03262: SAM D/R/L/C System Pin Multiplexer (SYSTEM PINMUX) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

License, Rules, and Application Form

US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

Cisco Embedded Automation Systems (EASy): Test Network Management Notifications

Denkh XML Reporter. Web Based Report Generation Software. Written By Scott Auge Amduus Information Works, Inc.

Table of Contents Overview...2 Selecting Post-Processing: ColorMap...3 Overview of Options Copyright, license, warranty/disclaimer...

Installation. List Wrangler - Mailing List Manager for GTK+ Part I. 1 Requirements. By Frank Cox. September 3,

User Manual. Date Aug 30, Enertrax DAS Download Client

FLAMEBOSS 300 MANUAL

DAP Controller FCO

SW MAPS TEMPLATE BUILDER. User s Manual

IETF TRUST. Legal Provisions Relating to IETF Documents. Approved November 6, Effective Date: November 10, 2008

Business Rules NextAge Consulting Pete Halsted

HYDROOBJECTS VERSION 1.1

AT11512: SAM L Brown Out Detector (BOD) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

Open Source Used In c1101 and c1109 Cisco IOS XE Fuji

Hyperscaler Storage. September 12, 2016

Migration Tool. Migration Tool (Beta) Technical Note

File Servant User Manual

NTLM NTLM. Feature Description

Encrypted Object Extension

Use in High-Safety Applications

This file includes important notes on this product and also the additional information not included in the manuals.

HYDRODESKTOP VERSION 1.4 QUICK START GUIDE

Copyright PFU LIMITED 2016

FLAME BOSS 200V2 & 300 MANUAL. Version 2.6 Download latest at FlameBoss.com/manuals

Crypto Application. version 1.2

SORRENTO MANUAL. by Aziz Gulbeden

IETF TRUST. Legal Provisions Relating to IETF Documents. February 12, Effective Date: February 15, 2009

TWAIN driver User s Guide

Internet Connection Guide

invenio-formatter Documentation

iphone/ipad Connection Manual

Data Deduplication Metadata Extension

LoadMaster VMware Horizon (with View) 6. Deployment Guide

PyQ Documentation. Release 3.8. Enlightenment Research, LLC.

nacelle Documentation

TheGreenBow VPN Client ios User Guide

Fujitsu ScandAll PRO V2.1.5 README

micawber Documentation

Kron Documentation. Release qtfkwk

GoldSim License Portal A User s Guide for Managing Your GoldSim Licenses

The Cron service allows you to register STAF commands that will be executed at a specified time interval(s).

Moodle. Moodle. Deployment Guide

User Guide. Calibrated Software, Inc.

This file includes important notes on this product and also the additional information not included in the manuals.

Simba Cassandra ODBC Driver with SQL Connector

Grouper UI csrf xsrf prevention

1 (5) APPLICATION NOTE SCA11H HTTP API SAMPLE CODE. Murata Electronics Oy SCA11H Doc.No Rev. 1

Tenable Hardware Appliance Upgrade Guide

doubles Documentation

Copyright PFU LIMITED

RSA Two Factor Authentication

Watch 4 Size v1.0 User Guide By LeeLu Soft 2013

DAP Controller FCO

Transcription:

Flask-Caching Documentation Release 1.0.0 Thadeus Burgess, Peter Justin Nov 01, 2017

Contents 1 Installation 3 2 Set Up 5 3 Caching View Functions 7 4 Caching Other Functions 9 5 Memoization 11 5.1 Deleting memoize cache......................................... 12 6 Caching Jinja2 Snippets 13 7 Clearing Cache 15 8 Configuring Flask-Caching 17 9 Built-in Cache Backends 21 9.1 NullCache................................................ 21 9.2 SimpleCache............................................... 21 9.3 FileSystemCache............................................. 21 9.4 RedisCache................................................ 22 9.5 MemcachedCache............................................ 22 9.6 GAEMemcachedCache......................................... 23 9.7 SASLMemcachedCache......................................... 23 9.8 SpreadSASLMemcachedCache..................................... 23 10 Custom Cache Backends 25 11 API 27 12 Additional Information 29 12.1 Changelog................................................ 29 12.2 License.................................................. 33 Python Module Index 35 i

ii

Flask-Caching is an extension to Flask that adds caching support for various backends to any Flask application. Besides providing support for all of werkzeug s supported caching backends through a uniformed API, it is also possible to develop your own caching backend by subclassing werkzeug.contrib.cache.basecache class. Contents 1

2 Contents

CHAPTER 1 Installation Install the extension with one of the following commands: $ easy_install Flask-Caching or alternatively if you have pip installed: $ pip install Flask-Caching 3

4 Chapter 1. Installation

CHAPTER 2 Set Up Cache is managed through a Cache instance: from flask import Flask from flask_caching import Cache app = Flask( name ) # Check Configuring Flask-Caching section for more details cache = Cache(app, config={'cache_type': 'simple'}) You may also set up your Cache instance later at configuration time using init_app method: cache = Cache(config={'CACHE_TYPE': 'simple'}) app = Flask( name ) cache.init_app(app) You may also provide an alternate configuration dictionary, useful if there will be multiple Cache instances each with a different backend.: #: Method A: During instantiation of class cache = Cache(config={'CACHE_TYPE': 'simple'}) #: Method B: During init_app call cache.init_app(app, config={'cache_type': 'simple'}) New in version 0.7. 5

6 Chapter 2. Set Up

CHAPTER 3 Caching View Functions To cache view functions you will use the cached() decorator. This decorator will use request.path by default for the cache_key.: @app.route("/") @cache.cached(timeout=50) def index(): return render_template('index.html') The cached decorator has another optional argument called unless. This argument accepts a callable that returns True or False. If unless returns True then it will bypass the caching mechanism entirely. Warning: When using cached on a view, take care to put it between Flask s @route decorator and your function definition. Example: @app.route('/') @cache.cached(timeout=50) def index(): return 'Cached for 50s' If you reverse both decorator, what will be cached is the result of @route decorator, and not the result of your view function. 7

8 Chapter 3. Caching View Functions

CHAPTER 4 Caching Other Functions 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 the value (i.e. the cached result) of the key will be returned.: @cache.cached(timeout=50, key_prefix='all_comments') def get_all_comments(): comments = do_serious_dbio() return [x.author for x in comments] cached_comments = get_all_comments() 9

10 Chapter 4. Caching Other Functions

CHAPTER 5 Memoization See memoize() In memoization, the functions arguments are also included into the cache_key. Note: With functions that do not receive arguments, cached() and memoize() are effectively the same. Memoize is also designed for methods, since it will take into account the identity. of the self or cls argument as part of the cache key. The theory behind memoization is that if you have a function you need to call several times in one request, it would only be calculated the first time that function is called with those arguments. For example, an sqlalchemy object that determines if a user has a role. You might need to call this function many times during a single request. To keep from hitting the database every time this information is needed you might do something like the following: class Person(db.Model): @cache.memoize(50) def has_membership(self, role_id): return Group.query.filter_by(user=self, role_id=role_id).count() >= 1 Warning: Using mutable objects (classes, etc) as part of the cache key can become tricky. It is suggested to not pass in an object instance into a memoized function. However, the memoize does perform a repr() on the passed in arguments so that if the object has a repr function that returns a uniquely identifying string for that object, that will be used as part of the cache key. For example, an sqlalchemy person object that returns the database id as part of the unique identifier.: class Person(db.Model): def repr (self): return "%s(%s)" % (self. class. name, self.id) 11

5.1 Deleting memoize cache New in version 0.2. You might need to delete the cache on a per-function bases. Using the above example, lets say you change the users permissions and assign them to a role, but now you need to re-calculate if they have certain memberships or not. You can do this with the delete_memoized() function.: cache.delete_memoized(user_has_membership) Note: If only the function name is given as parameter, all the memoized versions of it will be invalidated. However, you can delete specific cache by providing the same parameter values as when caching. In following example only the user-role cache is deleted: user_has_membership('demo', 'admin') user_has_membership('demo', 'user') cache.delete_memoized(user_has_membership, 'demo', 'user') 12 Chapter 5. Memoization

CHAPTER 6 Caching Jinja2 Snippets Usage: {% cache [timeout [,[key1, [key2,...]]]] %}... {% endcache %} By default the value of path to template file + block start line is used as cache key. Also key name can be set manually. Keys are concated together into a single string. that can be used to avoid the same block evaluating in different templates. Set the timeout to None for no timeout, but with custom keys: {% cache None "key" %}... Set timeout to del to delete cached value: {% cache 'del' %}... If keys are provided, you may easily generate the template fragment key and delete it from outside of the template context: from flask_caching import make_template_fragment_key key = make_template_fragment_key("key1", vary_on=["key2", "key3"]) cache.delete(key) Example: Considering we have render_form_field and render_submit macroses. {% cache 60*5 %} <div> <form> {% render_form_field form.username %} {% render_submit %} </form> 13

</div> {% endcache %} 14 Chapter 6. Caching Jinja2 Snippets

CHAPTER 7 Clearing Cache See clear(). Here s an example script to empty your application s cache: from flask_caching import Cache from yourapp import app, your_cache_config cache = Cache() def main(): cache.init_app(app, config=your_cache_config) with app.app_context(): cache.clear() if name == ' main ': main() Warning: Some backend implementations do not support completely clearing the cache. Also, if you re not using a key prefix, some implementations (e.g. Redis) will flush the whole database. Make sure you re not storing any other data in your caching database. 15

16 Chapter 7. Clearing Cache

CHAPTER 8 Configuring Flask-Caching The following configuration values exist for Flask-Caching: 17

CACHE_TYPE Specifies which type of caching object to use. This is an import string that will be imported and instantiated. It is assumed that the import object is a function that will return a cache object that adheres to the werkzeug cache API. For werkzeug.contrib.cache objects, you do not need to specify the entire import string, just one of the following names. Built-in cache types: null: NullCache (default) simple: SimpleCache filesystem: FileSystemCache redis: RedisCache (Werkzeug >= 0.7 and redis required) uwsgi: UWSGICache (Werkzeug >= 0.12 and uwsgi required) memcached: MemcachedCache (pylibmc or memcache required) gaememcached: GAEMemcachedCache saslmemcached: SASLMemcachedCache (pylibmc required) spreadsaslmemcached: SpreadSASLMemcached- Cache (pylibmc required) CACHE_NO_NULL_WARNING Silents the warning message when using cache type of null. CACHE_ARGS Optional list to unpack and pass during the cache class instantiation. CACHE_OPTIONS Optional dictionary to pass during the cache class instantiation. CACHE_DEFAULT_TIMEOUT The default timeout that is used if no timeout is specified. Unit of time is seconds. CACHE_THRESHOLD The maximum number of items the cache will store before it starts deleting some. Used only for SimpleCache and FileSystemCache CACHE_KEY_PREFIX A prefix that is added before all keys. This makes it possible to use the same memcached server for different apps. Used only for RedisCache, MemcachedCache and GAE- MemcachedCache. CACHE_UWSGI_NAME The name of the uwsgi caching instance to connect to, for example: mycache@localhost:3031, defaults to an empty string, which means uwsgi will cache in the local instance. If the cache is in the same instance as the werkzeug app, you only have to provide the name of the cache. CACHE_MEMCACHED_SERVERS A list or a tuple of server addresses. Used only for MemcachedCache CACHE_MEMCACHED_USERNAME Username for SASL authentication with memcached. Used only for SASLMemcachedCache CACHE_MEMCACHED_PASSWORD Password for SASL authentication with memcached. Used only for SASLMemcachedCache CACHE_REDIS_HOST A Redis server host. Used only for RedisCache. CACHE_REDIS_PORT A Redis server port. Default is 6379. Used only for Redis- Cache. CACHE_REDIS_PASSWORD A Redis password for server. Used only for RedisCache. CACHE_REDIS_DB A Redis db (zero-based number index). Default is 0. Used only for RedisCache. CACHE_DIR Directory to store cache. Used only for FileSystemCache. CACHE_REDIS_URL URL to connect to Redis server. Example redis:// 18 user:password@localhost:6379/2. Used only for Chapter 8. Configuring Flask-Caching RedisCache.

In addition the standard Flask TESTING configuration option is used. If this is True then Flask-Caching will use NullCache only. 19

20 Chapter 8. Configuring Flask-Caching

CHAPTER 9 Built-in Cache Backends 9.1 NullCache Set CACHE_TYPE to null to use this type. Cache that doesn t cache CACHE_DEFAULT_TIMEOUT 9.2 SimpleCache Set CACHE_TYPE to simple to use this type. Uses a local python dictionary for caching. This is not really thread safe. Relevant configuration values CACHE_DEFAULT_TIMEOUT CACHE_THRESHOLD 9.3 FileSystemCache Set CACHE_TYPE to filesystem to use this type. Uses the filesystem to store cached values CACHE_DEFAULT_TIMEOUT CACHE_DIR CACHE_THRESHOLD CACHE_OPTIONS 21

There is a single valid entry in CACHE_OPTIONS: mode, which should be a 3 digit linux-style permissions octal mode. 9.4 RedisCache Set CACHE_TYPE to redis to use this type. CACHE_DEFAULT_TIMEOUT CACHE_KEY_PREFIX CACHE_REDIS_HOST CACHE_REDIS_PORT CACHE_REDIS_PASSWORD CACHE_REDIS_DB CACHE_OPTIONS CACHE_REDIS_URL Entries in CACHE_OPTIONS are passed to the redis client as **kwargs 9.5 MemcachedCache Set CACHE_TYPE to memcached to use this type. Uses a memcached server as a backend. Supports either pylibmc or memcache or google app engine memcache library. Relevant configuration values CACHE_DEFAULT_TIMEOUT CACHE_KEY_PREFIX CACHE_MEMCACHED_SERVERS Note: Werkzeug does not pass additional configuration options to memcached backends. To add additional configuration to these caches, directly set the configuration options on the object after instantiation: from flask_caching import Cache cache = Cache() # Can't configure the client yet... cache.init_app(flask_app, {"CACHE_TYPE": "memcached"}) # Break convention and set options on the _client object # directly. For pylibmc behaviors: cache.cache._client.behaviors({"tcp_nodelay": True}) Alternatively, see Custom Cache Backends. 22 Chapter 9. Built-in Cache Backends

9.6 GAEMemcachedCache Set CACHE_TYPE to gaememcached to use this type. Is MemcachedCache under a different name. 9.7 SASLMemcachedCache Set CACHE_TYPE to saslmemcached to use this type. Uses a memcached server as a backend. Intended to be used with a SASL enabled connection to the memcached server. pylibmc is required and SASL must be supported by libmemcached. Relevant configuration values CACHE_DEFAULT_TIMEOUT CACHE_KEY_PREFIX CACHE_MEMCACHED_SERVERS CACHE_MEMCACHED_USERNAME CACHE_MEMCACHED_PASSWORD CACHE_OPTIONS Note: Since the SASL Memcached cache types do not use the werkzeug built-in cache infrastructure, they can be configured with CACHE_OPTIONS. New in version 0.10. 9.8 SpreadSASLMemcachedCache Set CACHE_TYPE to spreadsaslmemcached to use this type. Same as SASLMemcachedCache however, it has the ablity to spread value across multiple keys if it is bigger than the memcached treshold which by default is 1M. Uses pickle. New in version 0.11. Changed in version 1.1.0: Renamed spreadsaslmemcachedcache to spreadsaslmemcached for the sake of consistency. 9.6. GAEMemcachedCache 23

24 Chapter 9. Built-in Cache Backends

CHAPTER 10 Custom Cache Backends You are able to easily add your own custom cache backends by exposing a function that can instantiate and return a cache object. CACHE_TYPE will be the import string to your custom function. It should expect to receive three arguments. app args kwargs Your custom cache object must also subclass the werkzeug.contrib.cache.basecache class. Flask-Caching will make sure that threshold is already included in the kwargs options dictionary since it is common to all Base- Cache classes. An example Redis cache implementation: #: the_app/custom.py class RedisCache(BaseCache): def init (self, servers, default_timeout=500): pass def redis(app, config, args, kwargs): args.append(app.config['redis_servers']) return RedisCache(*args, **kwargs) With this example, your CACHE_TYPE might be the_app.custom.redis An example PylibMC cache implementation to change binary setting and provide username/password if SASL is enabled on the library: #: the_app/custom.py def pylibmccache(app, config, args, kwargs): return pylibmc.client(servers=config['cache_memcached_servers'], username=config['cache_memcached_username'], password=config['cache_memcached_password'], binary=true) 25

With this example, your CACHE_TYPE might be the_app.custom.pylibmccache 26 Chapter 10. Custom Cache Backends

CHAPTER 11 API 27

28 Chapter 11. API

CHAPTER 12 Additional Information 12.1 Changelog 12.1.1 Version 1.3.3 2017-06-25 Add support for multiple query params and use md5 for consistent hashing. PR #43. 12.1.2 Version 1.3.2 2017-06-25 Fix spreadsaslmemcached backend when using Python 3. Fix kwargs order when memoizing a function using Python 3.6 or greater. See #27. 12.1.3 Version 1.3.1 2017-06-20 Avoid breakage for environments with Werkzeug<0.12 installed because the uwsgi backend depends on Werkzeug >=0.12. See #38. 12.1.4 Version 1.3.0 2017-06-17 Add uwsgi Caching backend (requires Werkzeug >= 0.12) Provide a keyword query_string to the cached decorator in order to create the same cache key for different query string requests, so long as they have the same key/value (order does not matter). PR #35. Use pytest as test suite and test runner. Additionally, the tests have been split up into multiple files instead of having one big file. 29

12.1.5 Version 1.2.0 2017-02-02 Allows functions with kwargs to be memoized correctly. See #18. 12.1.6 Version 1.1.1 2016-12-09 Fix PyPI Package distribution. See #15. 12.1.7 Version 1.1.0 2016-12-09 Fix redis backend import mechanisim. See #14. Made backends a module to better control which cache backends to expose and moved our custom clients into a own module inside of the backends module. See also #14 (and partly some own changes). Some docs and test changes. See #8 and #12. 12.1.8 Version 1.0.1 2016-08-30 The caching wrappers like add, set, etc are now returning the wrapped result as someone would expect. See #5. 12.1.9 Version 1.0.0 2016-07-05 Changed the way of importing Flask-Cache. Instead of using the depreacted method for importing Flask Extensions (via flask.ext.cache), the name of the extension, flask_cache is used. Have a look at Flask s documentation for more information regarding this matter. This also fixes the deprecation warning from Flask. Lots of PEP8 and Documentation fixes. Renamed this fork Flask-Caching (flask_caching) as it will now be available on PyPI for download. In addition to the above mentioned fixes, following pull requests have been merged into this fork of Flask-Cache: #90 Update documentation: route decorator before cache #95 Pass the memoize parameters into unless(). #109 wrapped function called twice #117 Moves setting the app attribute to the _set_cache method #121 fix doc for delete_memoized #122 Added proxy for werkzeug get_dict #123 forced_update option to cache and memoize decorators #124 Fix handling utf8 key args (cherry-picked) #125 Fix unittest failing for redis unittest #127 Improve doc for using @cached on view #128 Doc for delete_memoized #129 tries replacing inspect.getargspec with either signature or getfullargspec if possible make_cache_key() returning incorrect key (cherry-picked) 30 Chapter 12. Additional Information

12.1.10 Version 0.13 2014-04-21 Port to Python >= 3.3 (requiring Python 2.6/2.7 for 2.x). Fixed bug with using per-memoize timeouts greater than the default timeout Added better support for per-instance memoization. Various bug fixes 12.1.11 Version 0.12 2013-04-29 Changes jinja2 cache templates to use stable predictable keys. Previously the key for a cache tag included the line number of the template, which made it difficult to predict what the key would be outside of the application. Adds config variable CACHE_NO_NULL_WARNING to silence warning messages when using null cache as part of testing. Adds passthrough to clear entire cache backend. 12.1.12 Version 0.11.1 2013-04-7 Bugfix for using memoize on instance methods. The previous key was id(self), the new key is repr(self) 12.1.13 Version 0.11 2013-03-23 Fail gracefully in production if cache backend raises an exception. Support for redis DB number Jinja2 templatetag cache now concats all args together into a single key instead of treating each arg as a separate key name. Added delete memcache version hash function Support for multiple cache objects on a single app again. Added SpreadSASLMemcached, if a value is greater than the memcached threshold which defaults to 1MB, this splits the value across multiple keys. Added support to use URL to connect to redis. 12.1.14 Version 0.10.1 2013-01-13 Added warning message when using cache type of null Changed imports to relative instead of absolute for AppEngine compatibility 12.1.15 Version 0.10.0 2013-01-05 Added saslmemcached backend to support Memcached behind SASL authentication. Fixes a bug with memoize when the number of args!= number of kwargs 12.1. Changelog 31

12.1.16 Version 0.9.2 2012-11-18 Bugfix with default kwargs 12.1.17 Version 0.9.1 2012-11-16 Fixes broken memoized on functions that use default kwargs 12.1.18 Version 0.9.0 2012-10-14 Fixes memoization to work on methods. 12.1.19 Version 0.8.0 2012-09-30 Migrated to the new flask extension naming convention of flask_cache instead of flaskext.cache Removed unnecessary dependencies in setup.py file. Documentation updates 12.1.20 Version 0.7.0 2012-08-25 Allows multiple cache objects to be instantiated with different configuration values. 12.1.21 Version 0.6.0 2012-08-12 Memoization is now safer for multiple applications using the same backing store. Removed the explicit set of NullCache if the Flask app is set testing=true Swapped Conditional order for key_prefix 12.1.22 Version 0.5.0 2012-02-03 Deleting memoized functions now properly functions in production environments where multiple instances of the application are running. get_memoized_names and get_memoized_keys have been removed. Added make_name to memoize, make_name is an optional callable that can be passed to memoize to modify the cache_key that gets generated. Added unless to memoize, this is the same as the unless parameter in cached memoization now converts all kwargs to positional arguments, this is so that when a function is called multiple ways, it would evaluate to the same cache_key 12.1.23 Version 0.4.0 2011-12-11 Added attributes for uncached, make_cache_key, cache_timeout to the decorated functions. 32 Chapter 12. Additional Information

12.1.24 Version 0.3.4 2011-09-10 UTF-8 encoding of cache key key_prefix argument of the cached decorator now supports callables. 12.1.25 Version 0.3.3 2011-06-03 Uses base64 for memoize caching. This fixes rare issues where the cache_key was either a tuple or larger than the caching backend would be able to support. Adds support for deleting memoized caches optionally based on function parameters. Python 2.5 compatibility, plus bugfix with string.format. Added the ability to retrieve memoized function names or cache keys. 12.1.26 Version 0.3.2 Bugfix release. Fixes a bug that would cause an exception if no CACHE_TYPE was supplied. 12.1.27 Version 0.3.1 Pypi egg fix. 12.1.28 Version 0.3 CACHE_TYPE changed. Now one of [ null, simple, memcached, gaememcached, filesystem ], or an import string to a function that will instantiate a cache object. This allows Flask-Cache to be much more extensible and configurable. 12.1.29 Version 0.2 CACHE_TYPE now uses an import_string. Added CACHE_OPTIONS and CACHE_ARGS configuration values. Added delete_memoized 12.1.30 Version 0.1 Initial public release 12.2 License Copyright (c) 2010 by Thadeus Burgess. Copyright (c) 2016 by Peter Justin. Some rights reserved. 12.2. License 33

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. search 34 Chapter 12. Additional Information

Python Module Index f flask_caching, 3 35

36 Python Module Index

Index F flask_caching (module), 1 37