Repository navigation
Introduce SimpleKeyMappingCache and ContainerKeySimpleCache - #8150
Merged
Merged
Conversation
labkey-jeckels
approved these changes
Oct 9, 2026
…code. remove() now returns whether an entry was removed or not.
This was referenced Oct 9, 2026
labkey-adam
added a commit
to LabKey/customModules
that referenced
this pull request
Oct 9, 2026
## Rationale Using Containers as cache keys is safe again (and convenient) ## Related Pull Requests - LabKey/platform#8150
labkey-adam
added a commit
to LabKey/targetedms
that referenced
this pull request
Oct 9, 2026
## Rationale Using Containers as cache keys is safe again (and convenient) ## Related Pull Requests - LabKey/platform#8150
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
Using
Containerobjects as cache keys can be very expensive, especially on servers with a large number of containers and workbooks. We want to cache using each container'sGUIDinstead of the Container object itself. See analysis here: #8134Changes
The above referenced PR and companion PRs switch every Container-keyed cache to a GUID-keyed cache. Each cache then implements new get/put/remove and other behaviors that map Containers to GUID and back, as needed.
This PR takes a different approach. Cache factory methods now optionally receive the cache key's class. In the case of a Container key, the factory returns a special cache whose methods take Containers but whose underlying cache uses GUID keys. Passing in Container.class is the only change needed to switch to this more efficient cache.
SimpleKeyMappingCacheimplements the five critical cache methods, mapping keys using the passed inFunctions. This general-purpose class can be used to map any cache key to a more efficient alternative. CacheManager has a registry that maps key classes to specialized caches that can be a SimpleKeyMappingCache (or some other specialized implementation).ContainerKeySimpleCacheis a one-line class that extends SimpleKeyMappingCache and provides the simple Container <-> GUID mapping functions.Tasks