-
Notifications
You must be signed in to change notification settings - Fork 2
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
Be more selective about cache invalidation, instead of always wiping the entire thing. #5
Comments
This is kind of intentional, the idea being that you don't want a later-defined method to lead to an incosistent memoized result. Instead, you always want the memoized thing returned to be exactly what you'd get if you actually called the function, e.g. @memoize foo(x) = "original"
foo(1) # memoizes 1 -> "original"
@memoize foo(x::Int) = "something else"
foo(1) # would return "original" if we didn't clear the cache just above However, your example brings up a point I hadn't thought of which is that its possible to be more selective than wiping the entire cache. Ie if you define |
Actually the ultimate solution here is to use backedges to just piggyback off of Julia method invalidations, which would mean we're being as selective as possible (see e.g. https://www.oxinabox.net/2021/02/13/Julia-1.6-what-has-changed-since-1.0.html#manually-created-back-edges-for-lowered-code-generated-functions). Doubt I myself have time to work on this in the near future but would be really cool to have. |
I just came across this while playing around in the REPL. I could see it potentially coming up in real life if somebody is using
@memoize
in a script.The text was updated successfully, but these errors were encountered: