-
Notifications
You must be signed in to change notification settings - Fork 130
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
Memoize key isn't always invertible #313
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, really appreciate this library!
I have a small feature request (and an accompanying PR), which is just to make the
.__cache_key__
of amemoize
d function invertible (which also means makingargs_to_key
actually produce unique keys for different arguments).A use case is migrating many different cached functions due to a source changes, e.g. suppose we had some caches that have been populated using:
and want to roll out new versions of these
and want to update migrate all of
OldClass
arguments to someNewClass
, as well as changing the signatures appropriately, so that we can keep our old caches, e.g. via something likeSince #195 / d55a50e, then the
args
andkwargs
delimiter inargs_to_key
is no longer a special sentinel, and soget_new_args_kwargs
needs to know the signature of whichever function it was previously caching to faithfully find out the arguments used for that key. Namely, there's signatures where we couldn't faithfully determine where the(None,)
delimiter betweenargs
andkwargs
inargs_to_key
is placed (iftyped=False
), e.g. forMy proposed fix (#312) is just to change the
key
accumulation ofkwargs
to use its (key, value) pairs.The text was updated successfully, but these errors were encountered: