Skip to content

Automatically (with help) invalidate cache when code changes #35

Open
@jdavid

Description

@jdavid

Sometimes a change in the code should trigger the invalidation of the cache. The idea is to add the version optional parameter to cache_memoize, defaulting to None. Then the version, if not None, would be added to the cache key.

We could use it like this:

@cache_memoize(60)
def f(...):

Then we fix a bug in f and write:

@cache_memoize(60, version=1)

Another bug fixed (so many 🐛 🪲 ) :

@cache_memoize(60, version=2) 

So, when the fixes are deployed the cache will be invalidated, instead of returning a wrong cached value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions