Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultTTLSeconds = int64(3600) DefaultMaxCost = uint64(1000) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicCache ¶
type BasicCache[T any] struct { // contains filtered or unexported fields }
func (*BasicCache[T]) Close ¶
func (c *BasicCache[T]) Close()
func (*BasicCache[T]) Delete ¶
func (c *BasicCache[T]) Delete(key string)
func (*BasicCache[T]) Get ¶
func (c *BasicCache[T]) Get(key string) (T, bool)
func (*BasicCache[T]) Set ¶
func (c *BasicCache[T]) Set(key string, value T, cost uint64, expiresInSeconds int64) error
func (*BasicCache[T]) SetWithDefaultTTL ¶ added in v1.2.1
func (c *BasicCache[T]) SetWithDefaultTTL(key string, value T, cost uint64) error
type EvictItemFunc ¶
EvictItemFunc can be used to tell the cache not to evict an item based on the provided, key, value or expiryTime.
type Option ¶
type Option func(*Config)
func WithCleanupFrequency ¶
func WithEvictionFunction ¶
func WithEvictionFunction(f EvictItemFunc) Option
func WithMaxCost ¶
Click to show internal directories.
Click to hide internal directories.