Package cachingtest contains helpers for testing code that uses caching package.
func WithGlobalCache ¶
WithGlobalCache installs given BlobCaches as "global" in the context.
'caches' is a map from a namespace to BlobCache instance. If some other namespace is requested, the corresponding caching.GlobalCache call will panic.
BlobCache implements caching.BlobCache on top of lru.Cache for testing.
Useful for mocking caching.GlobalCache in tests. See also WithGlobalCache below.
Get returns a cached item or ErrCacheMiss if it's not in the cache.