A caching extension for Flask

Overview

Flask-Caching

A fork of the Flask-cache extension which adds easy cache support to Flask.

Installing

Install and update using pip:

$ pip install -U flask-caching

Donate

The Pallets organization develops and supports Flask and the libraries it uses. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects, please donate today.

Links

Comments
  • add request body based caching

    add request body based caching

    This PR is a stab at #71, caching based on request body.

    I implemented it because it seemed like a fairly easy thing to do and I was looking for an excuse to dig through this projects source a little bit to get a better understanding, but I would like to raise the point that this functionality is very dangerous.

    The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server.

    The difference between PUT and POST is that PUT is idempotent: calling it once or several times successively has the same effect (that is no side effect), where successive identical POST may have additional effects, like passing an order several times.

    POST requests are typically for operations like resource creation on the server, and I worry that implementing this feature will lead some users astray, either by caching routes and thus essentially dropping requests since they never go through the server logic, or misinforming less experienced users into flawed usage of POST requests.

    What do you think @sh4nks?

    resolves #71

    opened by buckley-w-david 18
  • Concurrency problem

    Concurrency problem

    https://github.com/sh4nks/flask-caching/blob/50bc8af30ae9f85714a119c323e8f09100d7a937/flask_caching/init.py#L385-L392

    If the cache has expired, after the execution of the code "rv = self.cache.get(cache_key)", there may be other processes that have already written values, but here will return a None instead of calling the function to get the new return value. Sorry for the bad English, all of the above are google translation.

    opened by mt3925 15
  • WIP: Redis sentinel support

    WIP: Redis sentinel support

    Documented solution for #40

    This is basically the original commit of @sh4nks (rebased onto the current master) with some documentation added. It still needs some testing and possibly some additions, but it seems to be a good start.

    opened by gergelypolonkai 11
  • add a `make_cache_key` parameter

    add a `make_cache_key` parameter

    This PR is essentially a more considered version of #76

    After the additional discussion with @bzed I changed my stance on the functionality, but actually even further it seemed like what the library actually needed was a way to allow the consumer complete control over the cache key generation if they so wished.

    I have added a make_cache_key parameter to the cached decorator for this purpose.

    This should allow for use cases such as #71, an example of which is in the test added in this PR

    opened by buckley-w-david 9
  • Add Google Cloud Storage Cache

    Add Google Cloud Storage Cache

    This is useful in cloud environments where shared disk cache doesn't exist, but the computation takes a lot of resources and the resulted data doesn't fit easily in Memcached or Redis.

    I used an abandoned S3 pull request as a starting point. https://github.com/pallets/cachelib/pull/6

    opened by oittaa 8
  • Control caching based on response

    Control caching based on response

    I might be missing entierly the intent of the developers, and possibly there is a much better solution to my problem (#91). This is just what I implemented which is sufficient for my needs, I wonder if it makes any sense.

    opened by volodymyrss 8
  • delete_many stop at first error

    delete_many stop at first error

        def delete_many(self, *keys):
            """Deletes multiple keys at once.
    
            :param keys: The function accepts multiple keys as positional
                         arguments.
            :returns: Whether all given keys have been deleted.
            :rtype: boolean
            """
            return all(self.delete(key) for key in keys)
    

    Currently the delete loop stops at the first item that is False (it's the behavior of the all function if evaluation is done inside) This is annoying because you have to check the presence in the cache of all the keys you want to delete. The default behaviour should be to continue the deletion despite the errors. In this way the trick is to bypass the evaluation during the loop:

     return all([self.delete(key) for key in keys])
    

    Or add this as option ?

    def delete_many(self, *keys, ignore_errors=False)
    

    Note: I found this problem with the file system cache

    bug 
    opened by johaven 8
  • TypeError: sequence item 0: expected str instance bytes found

    TypeError: sequence item 0: expected str instance bytes found

    Exception possibly due to cache backend.
    Traceback (most recent call last):
      File "https://github.com/sh4nks/flask-caching/blob/master/flask_caching/__init__.py"
        rv = self.cache.get(cache_key)
      File "https://github.com/sh4nks/flask-caching/blob/master/flask_caching/backends/clients.py"
        return self._get(key)
        serialized = ''.join([v for v in result if v is not None]
    TypeError: sequence item 0: expected str instance, bytes found
    

    Python 3.6.0 Flask-Cache==0.13.1

    needs info 
    opened by reubano 8
  • pylibmc is not thread-safe

    pylibmc is not thread-safe

    The way pylibmc client is used is not thread-safe. I think flask-caching should use the ThreadMappedPool. Otherwise on threaded Flask application, we must use python-memcached but there is no way to force to use this library.

    question 
    opened by cedk 7
  • _pickle.UnpicklingError: invalid load key, '9'

    _pickle.UnpicklingError: invalid load key, '9'

    using blueprints, FileSystemCache on Google App Engine Standard Python3.7 and having the cache separate:

    cache.py:

    from flask_caching import Cache
    cache = Cache()
    

    config:

    CACHE_CONFIG = {
        'CACHE_TYPE': 'filesystem',
        'CACHE_DIR': '/tmp',
        'CACHE_THRESHOLD': 1000,
        'CACHE_DEFAULT_TIMEOUT': 3600,
    }
    

    app.py:

    app = Flask(__name__)
    cache.init_app(app, config.CACHE_CONFIG)
    app.config.from_object(flask_config)
    

    blueprint:

    from cache import cache 
    
    @public.route('/<lang>/', methods=['GET'])
    @cache.cached()
    def page(lang):
        ...
    

    Then getting this error:

    ERROR:root:Traceback (most recent call last):
      File "/tmp/tmphwgdsy/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
        rv = self.dispatch_request()
      File "/tmp/tmphwgdsy/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
        return self.view_functions[rule.endpoint](**req.view_args)
      File "/tmp/tmphwgdsy/lib/python3.6/site-packages/flask_caching/__init__.py", line 400, in decorated_function
        timeout=decorated_function.cache_timeout,
      File "/tmp/tmphwgdsy/lib/python3.6/site-packages/flask_caching/backends/filesystem.py", line 160, in set
        self._prune()
      File "/tmp/tmphwgdsy/lib/python3.6/site-packages/flask_caching/backends/filesystem.py", line 109, in _prune
        expires = pickle.load(f)
    _pickle.UnpicklingError: invalid load key, '9'.
    
    opened by fili 7
  • Function having only *args and *kwargs fails

    Function having only *args and *kwargs fails

    In the context of my plugin flask-capitains-nemo ( https://github.com/Capitains/flask-capitains-nemo ), I am trying to get memoized a certain list of functions. I currently cache dynamically these one through :

            if self.cache is not None:
                for func, instance in self.cached:
                    setattr(instance, func.__name__, self.cache.memoize()(func))
    

    It works well, as long as I don't cache functions that have no enforced args or kwargs schemes but are actually route dispatcher :

    def render(self, template, **kwargs):
    

    will always create the key : flask_nemo.Nemo.render('main::collection.html',){} as the output of self._memoize_kwargs_to_args will not work with a **kwargs system. It is most likely the result of the use of get_arg_names. which will find only one defined arg.

    I'll be trying to propose a fix for this issue.

    opened by PonteIneptique 7
  • Bump sphinx from 5.3.0 to 6.0.0 in /requirements

    Bump sphinx from 5.3.0 to 6.0.0 in /requirements

    Bumps sphinx from 5.3.0 to 6.0.0.

    Release notes

    Sourced from sphinx's releases.

    v6.0.0

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.0.0b2

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.0.0b1

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    Changelog

    Sourced from sphinx's changelog.

    Release 6.0.0 (released Dec 29, 2022)

    Dependencies

    • #10468: Drop Python 3.6 support
    • #10470: Drop Python 3.7, Docutils 0.14, Docutils 0.15, Docutils 0.16, and Docutils 0.17 support. Patch by Adam Turner

    Incompatible changes

    • #7405: Removed the jQuery and underscore.js JavaScript frameworks.

      These frameworks are no longer be automatically injected into themes from Sphinx 6.0. If you develop a theme or extension that uses the jQuery, $, or $u global objects, you need to update your JavaScript to modern standards, or use the mitigation below.

      The first option is to use the sphinxcontrib.jquery_ extension, which has been developed by the Sphinx team and contributors. To use this, add sphinxcontrib.jquery to the extensions list in conf.py, or call app.setup_extension("sphinxcontrib.jquery") if you develop a Sphinx theme or extension.

      The second option is to manually ensure that the frameworks are present. To re-add jQuery and underscore.js, you will need to copy jquery.js and underscore.js from the Sphinx repository_ to your static directory, and add the following to your layout.html:

      .. code-block:: html+jinja

      {%- block scripts %} {{ super() }} {%- endblock %}

      .. _sphinxcontrib.jquery: https://github.com/sphinx-contrib/jquery/

      Patch by Adam Turner.

    • #10471, #10565: Removed deprecated APIs scheduled for removal in Sphinx 6.0. See :ref:dev-deprecated-apis for details. Patch by Adam Turner.

    • #10901: C Domain: Remove support for parsing pre-v3 style type directives and roles. Also remove associated configuration variables c_allow_pre_v3 and c_warn_on_allowed_pre_v3. Patch by Adam Turner.

    Features added

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump pytest-asyncio from 0.20.2 to 0.20.3 in /requirements

    Bump pytest-asyncio from 0.20.2 to 0.20.3 in /requirements

    Bumps pytest-asyncio from 0.20.2 to 0.20.3.

    Release notes

    Sourced from pytest-asyncio's releases.

    pytest-asyncio 0.20.3


    title: 'pytest-asyncio'

    image

    image

    image

    Supported Python versions

    image

    pytest-asyncio is a pytest plugin. It facilitates testing of code that uses the asyncio library.

    Specifically, pytest-asyncio provides support for coroutines as test functions. This allows users to await code inside their tests. For example, the following code is executed as a test item by pytest:

    @pytest.mark.asyncio
    async def test_some_asyncio_code():
        res = await library.do_something()
        assert b"expected result" == res
    

    Note that test classes subclassing the standard unittest library are not supported. Users are advised to use unittest.IsolatedAsyncioTestCase or an async framework such as asynctest.

    pytest-asyncio is available under the Apache License 2.0.

    Installation

    To install pytest-asyncio, simply:

    $ pip install pytest-asyncio
    

    ... (truncated)

    Changelog

    Sourced from pytest-asyncio's changelog.

    0.20.3 (22-12-08)

    • Prevent DeprecationWarning to bubble up on CPython 3.10.9 and 3.11.1. [#460](https://github.com/pytest-dev/pytest-asyncio/issues/460) <https://github.com/pytest-dev/pytest-asyncio/issues/460>_
    Commits
    • 007e8ec [fix] Prevent DeprecationWarning about existing event loops to bubble up into...
    • 44ca3da Build(deps): Bump zipp from 3.10.0 to 3.11.0 in /dependencies/default (#455)
    • c3c601c Build(deps): Bump pypa/gh-action-pypi-publish from 1.5.1 to 1.5.2 (#456)
    • a962e2b Build(deps): Bump importlib-metadata in /dependencies/default (#454)
    • 56a393a Simplify README, move most content to a separate user documentation. (#448)
    • 3c78732 Build(deps): Bump hypothesis in /dependencies/default (#453)
    • d6a9a72 Build(deps): Bump exceptiongroup in /dependencies/default (#451)
    • 42da7a0 Build(deps): Bump hypothesis in /dependencies/default (#450)
    • 0b281b1 Build(deps): Bump mypy from 0.990 to 0.991 in /dependencies/default (#446)
    • d39589c Update pre-commit hooks (#449)
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump tox from 3.27.1 to 3.28.0 in /requirements

    Bump tox from 3.27.1 to 3.28.0 in /requirements

    Bumps tox from 3.27.1 to 3.28.0.

    Release notes

    Sourced from tox's releases.

    3.28.0

    What's Changed

    Full Changelog: https://github.com/tox-dev/tox/compare/3.27.1...3.28.0

    Changelog

    Sourced from tox's changelog.

    v3.28.0 (2022-12-14)

    Features ^^^^^^^^

    • Support provision of tox 4 with the min_version option - by :user:hroncok [#2661](https://github.com/tox-dev/tox/issues/2661) <https://github.com/tox-dev/tox/issues/2661>_
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump pallets-sphinx-themes from 2.0.2 to 2.0.3 in /requirements

    Bump pallets-sphinx-themes from 2.0.2 to 2.0.3 in /requirements

    Bumps pallets-sphinx-themes from 2.0.2 to 2.0.3.

    Changelog

    Sourced from pallets-sphinx-themes's changelog.

    Version 2.0.3

    Released 2022-12-24

    • Fix compatibility with packaging>=22.
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump types-redis from 4.3.21.6 to 4.3.21.7 in /requirements

    Bump types-redis from 4.3.21.6 to 4.3.21.7 in /requirements

    Bumps types-redis from 4.3.21.6 to 4.3.21.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump pre-commit from 2.20.0 to 2.21.0 in /requirements

    Bump pre-commit from 2.20.0 to 2.21.0 in /requirements

    Bumps pre-commit from 2.20.0 to 2.21.0.

    Release notes

    Sourced from pre-commit's releases.

    pre-commit v2.21.0

    Features

    Fixes

    Changelog

    Sourced from pre-commit's changelog.

    2.21.0 - 2022-12-25

    Features

    Fixes

    Commits
    • 40c5bda v2.21.0
    • bb27ea3 Merge pull request #2642 from rkm/fix/dotnet-nuget-config
    • c38e0c7 dotnet: ignore nuget source during tool install
    • bce513f Merge pull request #2641 from rkm/fix/dotnet-tool-prefix
    • e904628 fix dotnet hooks with prefixes
    • d7b8b12 Merge pull request #2646 from pre-commit/pre-commit-ci-update-config
    • 94b6178 [pre-commit.ci] pre-commit autoupdate
    • b474a83 Merge pull request #2643 from pre-commit/pre-commit-ci-update-config
    • a179808 [pre-commit.ci] pre-commit autoupdate
    • 3aa6206 Merge pull request #2605 from lorenzwalthert/r/fix-exe
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
Releases(v2.0.1)
  • v2.0.1(Jul 30, 2022)

  • v2.0.0(Jun 26, 2022)

  • v1.11.1(May 28, 2022)

  • v1.10.1(Mar 17, 2021)

    Released on March 17th 2021

    • A GoogleCloudStorageCache backend has been added to the user contributed caching backends. PR #214.
    • Fix a regression introduced in the last release which broke all applications subclassing the Cache class.
    • Add test_generic_get_bytes test case. PR #236.
    • Various improvements and fixes.
    Source code(tar.gz)
    Source code(zip)
  • v1.10.0(Mar 4, 2021)

    Released on March 4th 2021

    DEPRECATION NOTICE

    • uwsgicache is not officially maintained anymore and deprecated.

    • Caching backends are now loaded using the full path to the caching backend class. For officially supported caching backends it is sufficient to just specify the name of the backend class. See the documentation for a full list of caching backends: https://flask-caching.readthedocs.io/en/latest/#configuring-flask-caching

      In the next major release (2.0), this will be the only supported way.

    Added

    • Important: The way caching backends are loaded have been refactored. Instead of passing the name of the initialization function one can now use the full path to the caching backend class. For example: CACHE_TYPE="flask_caching.contrib.UWSGICache". In the next major release (2.0), this will be the only supported way.
      Thanks to @gergelypolonkai for doing the heavy lifting here!
    • Add Type Annotations. PR #198.
    • Add some basic logging to SimpleCache and FileSystemCache for better observability. PR #203.
    • Add option in memoize to ignore args via args_to_ignore. PR #201.
    • Add a Redis Cluster Mode (RedisClusterCache) caching backend. PR #173.

    Changed

    • Switch from Travis-CI to GitHub Actions
    • Do not let PIP install this package on unsupported Python Versions. PR #179.
    • Stop marking wheels as Python 2 compatible. PR #196.

    Fixed

    • Fix add() in RedisCache without a timeout. PR #218.
    • Fix error in how the FileSystemCache counts the number of files. PR #210.
    • Fix default_timeout not being properly passed to its super constructor. PR #187.
    • Fix kwargs not being passed on in function _memoize_make_cache_key. PR #184.
    • Fix uWSGI initialization by checking if uWSGI has the cache2 option enabled. PR #176.
    • Documentation updates and fixes.
    Source code(tar.gz)
    Source code(zip)
  • v1.9.0(Jun 2, 2020)

    Released on June 2nd 2020

    • Added an option to include the functions source code when generating the cache key. PR #156.
    • Added a new feature that allows one to completely control the way how cache keys are generated. For example, one can now implement a function that generates cache the keys based on the POST-based requests. PR #159.
    • Fixed a few cache backend naming collisions by renaming them from simple to simplecache, null to nullcache and filesystem to filesystemcache.
    • Explicitly pass the default_timeout to RedisCache from RedisSentinelCache.
    • Use os.replace instead of werkzeug's rename due to Windows raising an OSError if the dst file already exist.
    • Documentation updates and fixes.
    Source code(tar.gz)
    Source code(zip)
  • v1.8.0(Nov 25, 2019)

    Released on November 24th 2019

    Breaking: Dropped support for Python 2

    • Add option to specify if None is a cached value or not. See PR #140 and #141.
    • Allow to use __caching_id__ rather than __repr__ as an object caching key. PR #123.
    • The RedisCache backend now support generating the key_prefix via a callable. PR #109.
    • Emit a warning if the CACHE_TYPE is set to filesystem but no CACHE_DIR is set.
    • Fixes Google App Engine Memcache backend. See issue #120 for more details.
    • Various documentation updates and fixes.
    Source code(tar.gz)
    Source code(zip)
  • v1.7.2(May 30, 2019)

    Released on May 28th 2019

    This is the last version supporting Python 2!

    • Do not run a cached/memoized function if the cached return value is None. PR #108.
    Source code(tar.gz)
    Source code(zip)
  • v1.7.1(Apr 16, 2019)

    Released on April 16th 2019

    This is the last version supporting Python 2!

    • Fix introspecting Python 3 functions by using varkw. PR #101.
    • Remove leftover files (uwsgi.py) in PyPI package. See issue #102 for more details.
    Source code(tar.gz)
    Source code(zip)
  • v1.7.0(Mar 29, 2019)

    Released on March 29th 2019

    This is the last version supporting Python 2!

    • Added a feature called response_filter which enables one to only cache views depending on the response code. PR #99.
    • A DeprecationWarning got turned into a TypeError.
    Source code(tar.gz)
    Source code(zip)
  • v1.6.0(Mar 6, 2019)

    Released on March 6th 2019

    • The delete_many function is now able to ignore any errors and continue deleting the cache. However, in order to preserve backwards compatibility, the default mode is to abort the deletion process. In order to use the new deletion mode, one has to flip the config setting CACHE_IGNORE_ERRORS to True. This was and still is only relevant for the filesystem and simple cache backends. PR #94.
    • Re-added the gaememcached CACHE_TYPE for improved backwards compatibility.
    • Documentation improvements. PR #96
    Source code(tar.gz)
    Source code(zip)
  • v1.5.0(Feb 23, 2019)

    Released on February 23rd 2019

    Changes

    • Add support for a Redis Sentinel Cluster. PR #90.
    • Parameterize the hash function so alternatives can be used. PR #77.
    • Include the deprecated werkzeug.contrib.cache module in Flask-Caching. PR #75.
    Source code(tar.gz)
    Source code(zip)
  • v1.4.0(Sep 16, 2018)

    Released on April 16th 2018

    Changes

    • Fix logic for creating key for var args in memoize. PR #70.
    • Allow older Werkzeug versions by making the UWSGICache backend conditional. PR #55.
    • Some documentation improvements. PR #48, #51, #56 and #67.
    • Some CI improvements. PR #49 and #50.
    Source code(tar.gz)
    Source code(zip)
  • v1.3.3(Oct 5, 2017)

  • v1.3.2(Jun 25, 2017)

    Released on June 25th 2017

    Changes

    • Fix spreadsaslmemcached backend when using Python 3.
    • Fix kwargs order when memoizing a function using Python 3.6 or greater. See #27.
    Source code(tar.gz)
    Source code(zip)
  • v1.3.1(Jun 25, 2017)

    Released on June 20th 2017

    • Avoid breakage for environments with Werkzeug<0.12 installed because the uwsgi backend depends on Werkzeug >=0.12
    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Jun 18, 2017)

    Released on June 17th 2017

    • 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.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Jul 4, 2016)

    First release since 2013.

    • 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:

    Source code(tar.gz)
    Source code(zip)
Owner
Pallets Community
Community maintained extensions for Pallets projects.
Pallets Community
An implementation of memoization technique for Django

django-memoize django-memoize is an implementation of memoization technique for Django. You can think of it as a cache for function or method results.

Unhaggle 118 Dec 09, 2022
A caching extension for Flask

Flask-Caching Adds easy cache support to Flask. This is a fork of the Flask-Cache extension. Flask-Caching also includes the cache module from werkzeu

Peter Justin 774 Jan 02, 2023
CacheControl is a port of the caching algorithms in httplib2 for use with requests session object.

CacheControl CacheControl is a port of the caching algorithms in httplib2 for use with requests session object. It was written because httplib2's bett

Eric Larson 409 Dec 04, 2022
Persistent, stale-free, local and cross-machine caching for Python functions.

Persistent, stale-free, local and cross-machine caching for Python functions.

Shay Palachy 420 Dec 22, 2022
Automatic Flask cache configuration on Heroku.

flask-heroku-cacheify Automatic Flask cache configuration on Heroku. Purpose Configuring your cache on Heroku can be a time sink. There are lots of di

Randall Degges 39 Jun 05, 2022
Caching for HTTPX

Caching for HTTPX. Note: Early development / alpha, use at your own risk. This package adds caching functionality to HTTPX Adapted from Eric Larson's

Johannes 51 Dec 04, 2022
No effort, no worry, maximum performance.

Django Cachalot Caches your Django ORM queries and automatically invalidates them. Documentation: http://django-cachalot.readthedocs.io Table of Conte

NoriPyt 976 Dec 28, 2022
Simple caching transport for httpx

httpx-cache is yet another implementation/port is a port of the caching algorithms in httplib2 for use with httpx Transport object.

Ouail 28 Jan 01, 2023
A Python wrapper around the libmemcached interface from TangentOrg.

pylibmc is a Python client for memcached written in C. See the documentation at sendapatch.se/projects/pylibmc/ for more information. New in version 1

Ludvig Ericson 458 Dec 30, 2022
johnny cache django caching framework

Johnny Cache is a caching framework for django applications. It works with the django caching abstraction, but was developed specifically with the use

Jason Moiron 304 Nov 07, 2022
PyCache - simple key:value server written with Python

PyCache simple key:value server written with Python and client is here run server python -m pycache.server or from pycache.server import start_server

chick_0 0 Nov 01, 2022
Asyncio cache manager for redis, memcached and memory

aiocache Asyncio cache supporting multiple backends (memory, redis and memcached). This library aims for simplicity over specialization. All caches co

aio-libs 764 Jan 02, 2023
An ORM cache for Django.

Django ORMCache A cache manager mixin that provides some caching of objects for the ORM. Installation / Setup / Usage TODO Testing Run the tests with:

Educreations, Inc 15 Nov 27, 2022
A decorator for caching properties in classes.

cached-property A decorator for caching properties in classes. Why? Makes caching of time or computational expensive properties quick and easy. Becaus

Daniel Roy Greenfeld 658 Dec 01, 2022
Python disk-backed cache (Django-compatible). Faster than Redis and Memcached. Pure-Python.

DiskCache is an Apache2 licensed disk and file backed cache library, written in pure-Python, and compatible with Django.

Grant Jenks 1.7k Jan 05, 2023
Asynchronous cache manager designed for horizontally scaled web servers.

Introduction Asynchronous cache manager designed for horizontally scaled web applications. NOTE: Currently has implementation only for FastAPI using R

Serghei 23 Dec 01, 2022
Automatic caching and invalidation for Django models through the ORM.

Cache Machine Cache Machine provides automatic caching and invalidation for Django models through the ORM. For full docs, see https://cache-machine.re

846 Nov 26, 2022
RecRoom Library Cache Tool

RecRoom Library Cache Tool A handy tool to deal with the Library cache file. Features Parse Library cache Remove Library cache Parsing The script pars

Jesse 5 Jul 09, 2022
WSGI middleware for sessions and caching

Cache and Session Library About Beaker is a web session and general caching library that includes WSGI middleware for use in web applications. As a ge

Ben Bangert 500 Dec 29, 2022
Peerix is a peer-to-peer binary cache for nix derivations

Peerix Peerix is a peer-to-peer binary cache for nix derivations. Every participating node can pull derivations from each other instances' respective

92 Dec 13, 2022