-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically (with help) invalidate cache when code changes #35
Comments
I like that. One could perhaps use it like this: from gitutils import get_current_git_sha
current_git_sha = get_current_git_sha()
@cache_memoize(60, version=current_git_sha) |
That would, if you chose to use it like that, mean that a fresh new deployment triggers a different cache key for all memoized functions. |
Yes. It may be as well a more generic option (e.g. |
version / suffix would be nice, it can be set somewhere in project settings globally so if one really wants - all cache will be cleared when such option changes. |
I vote for Django itself does support the It should be easy to add just one more pass-through argument to |
Sometimes a change in the code should trigger the invalidation of the cache. The idea is to add the
version
optional parameter tocache_memoize
, defaulting toNone
. Then the version, if notNone
, would be added to the cache key.We could use it like this:
Then we fix a bug in
f
and write:Another bug fixed (so many 🐛 🪲 ) :
So, when the fixes are deployed the cache will be invalidated, instead of returning a wrong cached value.
The text was updated successfully, but these errors were encountered: