ncar-xdev/xpersist

feature: cache validation

Opened this issue · 0 comments

When I start up a new jupyter session, xpersist is assumes that cache files are correct.
This is not necessarily the case and it's kinda a hassle to work around this assumption.
It would be useful to attempt to validate cache file contents.

Based on advice of @dcherian, if token is computed as

token = dask.base.tokenize(self._func(*args, **kwargs))

the values are consistent across invocations and are computed relatively efficiently.

If this is done, then a potential approach for cache validation is to add this token to the object being cached, as an attribute. Then treat an existing cache file as correct if the token stored in the cache file matches the token for object.

Does this make sense?