-
-
Notifications
You must be signed in to change notification settings - Fork 329
LRUStoreCache
: cache "contains" by contains checks
#1499
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
LRUStoreCache
: cache "contains" by contains checks
#1499
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1499 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 37 37
Lines 14729 14735 +6
=========================================
+ Hits 14729 14735 +6
|
…che_contains_by_contains_check
Thank you. I can confirm that this fixes issue #1497. |
Could someone elaborate on why this is? It seems inconsistent--certainly different from how a normal mutable mapping works. |
Good question.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR!
This seems like an acceptable solution to me. I still find it strange that __contains__
and keys()
return inconsistent results, but I accept that behavior is desired for some stores.
@madsbk, please complete the TODO checklist (or cross out irrelevant items).
Added release notes, I think this can be merged |
Fixes #1497 by caching
LRUStoreCache.__contains__
calls individually.Apparently in
ZarrTiffStore
, a successful "contains" check ofkey
doesn't necessarily means thatkey
is inZarrTiffStore.keys()
.E.g. if
key
is a string and not inZarrTiffStore.keys()
, it still might be "contained" byZarrTiffStore
, see https://github.com/cgohlke/tifffile/blob/master/tifffile/tifffile.py#L12222I guess that is why
LRUStoreCache
has both a key and a contains cache?TODO:
[ ] Add docstrings and API docs for any new/modified user-facing classes and functions[ ] New/modified features documented in docs/tutorial.rstcc. @cgohlke