Skip to content
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

Refresh cache when the function code source change #88

Closed
abocquet opened this issue May 3, 2022 · 1 comment
Closed

Refresh cache when the function code source change #88

abocquet opened this issue May 3, 2022 · 1 comment

Comments

@abocquet
Copy link

abocquet commented May 3, 2022

Currently, the cache is loaded even if the function code has changed. For prototyping purposes, it would be great to have the possibility to reload the cache on source code change.

Example :

from cachier import cachier

@cachier()
def f(x):
    print("This will print once")
    return x + 3
print(f(0)) # -> 3

will put the result of f(0) in cache for instance. But, when changing 3 to 4 :

@cachier()
def f(x):
    print("This will not be printed unless cache is invalidated manually")
    return x + 4
print(f(0))  # -> 3 

TBD :

  • This behavior could be default, or enabled with a parameter reload_on_source_change
  • Should it refresh only when the body of the function changes (easy) or recursively on any change of a function called in the body (harder, maybe not necessary)
@shaypal5
Copy link
Collaborator

shaypal5 commented May 3, 2022

This is a duplicate of #34 , and is often discussed.

Please see the last comment there for the history of attempts to add this feature. :)

#34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants