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

Use already existing cache if found during build #1747

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

camuthig
Copy link

This pull request attempts to update the PlainRegistry to set self._cache to the data retrieve from the cached data. Tests are passing, so I believe this change resolves the issue linked, but I'm not confident if it is the correct resolution or not.

When building a unit registry using a cache, the read cache data is not
getting leveraged. Instead a new cache is getting built, but without the
dimensional equivalents.

This creates a behavior where you create a new UnitRegistry from already
cached files and call `get_compatible_units` it will always fail with
a key error.
@hgrecco
Copy link
Owner

hgrecco commented Apr 25, 2023

I don't think this is a good idea without further thoughts. Basically, I am worried that we might be caching objects which are specific to this registry. Remember that certain objects (Quantity/Unit/Context/Measurement) are registry instance specific and should not be cached. That part of the code is not in use to investigate if this was a good idea or not.

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

Successfully merging this pull request may close these issues.

Dimensional equivalents missing when loading from cache
2 participants