package
3.4.2
Repository: https://github.com/grafana/loki.git
Documentation: pkg.go.dev

# Packages

# Functions

CollectStats returns a new Cache that keeps various statistics on cache usage.
ExtractCacheGenNumber gets the cache gen from the context.
HashKey hashes key into something you can store in memcached.
InjectCacheGenNumber returns a derived context containing the cache gen.
Instrument returns an instrumented cache.
IsCacheConfigured determines if either of the following caches is configured: - memcached - redis - embedded-cache - specific cache implementation.
IsEmptyTieredCache is used to determine whether the current Cache is implemented by an empty tiered.
IsMemcacheSet returns whether a non empty Memcache config is set or not, based on the configured host or addresses.
IsRedisSet returns whether a non empty Redis config is set or not, based on the configured endpoint.
New creates a new Cache using Config.
NewBackground returns a new Cache that does stores on background goroutines.
NewCacheGenNumMiddleware creates a new GenNumMiddleware.
NewEmbeddedCache returns a new initialised EmbeddedCache where the key is a string and the value is a slice of bytes.
NewMemcached makes a new Memcached.
NewMemcachedClient creates a new MemcacheClient that gets its server list from SRV and updates the server list on a regular basis.
NewMockCache makes a new MockCache.
NewNoopCache returns a no-op cache.
NewRedisCache creates a new RedisCache.
NewRedisClient creates Redis client.
NewSnappy makes a new snappy encoding cache wrapper.
NewTiered makes a new tiered cache.
NewTypedEmbeddedCache returns a new initialised EmbeddedCache with the key and value of requested types.
StopOnce wraps a Cache and ensures its only stopped once.
StringToBytes converts string to byte slice.

# Structs

BackgroundConfig is config for a Background Cache.
Config for building Caches.
EmbeddedCache is a simple (comparable -> any) cache which uses a fifo slide to manage evictions.
EmbeddedCacheConfig represents in-process embedded cache config.
Entry
GenNumMiddleware adds gen number to keys from context.
Memcached type caches chunks in memcached.
MemcachedClientConfig defines how a MemcachedClient should be constructed.
MemcachedConfig is config to make a Memcached.
RedisCache type caches chunks in redis.
RedisConfig defines how a RedisCache should be constructed.

# Interfaces

Cache byte arrays by key.
MemcachedClient interface exists for mocking memcacheClient.
Interface for EmbeddedCache Matches the interface from cache.Cache but has generics.