Documentation ¶
Overview ¶
Package cachingtest contains helpers for testing code that uses caching package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.
Types ¶
type BlobCache ¶
type BlobCache struct { LRU *lru.Cache[string, []byte] // the underlying LRU cache Err error // if non-nil, will be returned by Get and Set }
BlobCache implements caching.BlobCache on top of lru.Cache for testing.
Useful for mocking caching.GlobalCache in tests. See also WithGlobalCache below.
func NewBlobCache ¶
func NewBlobCache() *BlobCache
NewBlobCache initializes empty blob cache with unlimited capacity.
Click to show internal directories.
Click to hide internal directories.