package
0.0.0-20180325151459-ed3cc772bb2f
Repository: https://github.com/adirelle/go-libs.git
Documentation: pkg.go.dev
# Functions
Emitter sends cache events to the given channel.
Eviction adds a layer to evict entries when the underlying cache is full.
Expiration adds automatic expiration to new entries using the given delay.
ExpirationUsingClock adds automatic expiration to new entries using the given clock.
LFUEviction adds entry eviction using the Least-Frequently-Used strategy.
Loader adds a layer to generate values on demand.
LogErrors catchs and logs errors using the given function.
LRUEviction adds entry eviction using the Least-Recently-Used strategy.
Name gives a name to a cache.
NewLFUEviction creates a new instance of the Least-Frequently-Used strategy.
NewLoader creates a pseudo-cache from a LoaderFunc.
NewLRUEviction creates a new instance of the Least-Recently-Used strategy.
NewMemoryStorage creates an empty cache using a map and a sync.RWMutex.
NewVoidStorage returns a cache that does not store nor return any entries, but can be used for side effects of options.
SingleFlight adds a layer that deduplicates Get queries from concurrent goroutines.
Spy logs operations using the given function.
Validate validates every entry using the given function.
ValidateValidable is a ValidatorFunc that handles Validable.
WriteThrough adds a second-level cache.
# Variables
ErrKeyNotFound is returned by Cache.Get*() whenever the key is not present in the cache.
RealClock is a Clock implementation that uses time.Now().
# Interfaces
Cache is the main abstraction.
Clock is a simple clock abstraction to be used with ExpirationUsingClock.
EvictionStrategy is used to select entries to evict when the underlying cache is full.
Validable can validate itself.
# Type aliases
EventType represents the type of operation that has been performed.
No description provided by the author
LoaderFunc simulates a cache by calling the functions on call to Get.
Option adds optional features new to a cache.
Printf is a printf-like function to be used with Spy().
ValidatorFunc is used to validate cache entries.