Documentation
¶
Index ¶
- Variables
- type Cache
- type EvictCallback
- type LruCache
- type Option
- func WithBackgroundCheckCache() Option
- func WithDeleteExpiredCacheOnGet() Option
- func WithEvictCallback(fn EvictCallback) Option
- func WithExpiration(expiration time.Duration) Option
- func WithGoTimeNow() Option
- func WithInterval(interval time.Duration) Option
- func WithMaxSize(maxSize int) Option
- func WithUpdateCacheExpirationOnGet() Option
- type OptionFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCacheIsNotFound = errors.New("cache is not found") ErrCacheWasExpired = errors.New("cache was expired") )
View Source
var DefaultUpdateTimeTickInterval = time.Millisecond * 300
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable, V any] interface { Get(K) (V, error) Set(K, V) Delete(K) Contains(K) bool Stop() }
type EvictCallback ¶
type LruCache ¶
type LruCache[K comparable, V any] struct { // contains filtered or unexported fields }
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithBackgroundCheckCache ¶
func WithBackgroundCheckCache() Option
func WithDeleteExpiredCacheOnGet ¶
func WithDeleteExpiredCacheOnGet() Option
func WithEvictCallback ¶
func WithEvictCallback(fn EvictCallback) Option
func WithExpiration ¶
func WithGoTimeNow ¶
func WithGoTimeNow() Option
func WithInterval ¶
func WithMaxSize ¶
func WithUpdateCacheExpirationOnGet ¶
func WithUpdateCacheExpirationOnGet() Option
type OptionFunc ¶
type OptionFunc func(o *options)
Click to show internal directories.
Click to hide internal directories.