Documentation ¶
Index ¶
- type Cache
- func (c *Cache[K, V]) Close() error
- func (c *Cache[K, V]) Flush()
- func (c *Cache[K, V]) Get(key K) (v V, expirationTime time.Time, ok bool)
- func (c *Cache[K, V]) Len() int
- func (c *Cache[K, V]) Range(f func(key K, v V, expirationTime time.Time) error) error
- func (c *Cache[K, V]) Store(key K, v V, expirationTime time.Time)
- type Key
- type Opts
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
Cache is a simple map cache that stores values in memory. It is safe for concurrent use.
func New ¶
New initializes a Cache. The minimum size is 1024. cleanerInterval specifies the interval that Cache scans and discards expired values. If cleanerInterval <= 0, a default interval will be used.
func (*Cache[K, V]) Flush ¶
func (c *Cache[K, V]) Flush()
Flush removes all stored entries from this cache.
type Key ¶
type Key interface { concurrent_lru.Hashable }
Click to show internal directories.
Click to hide internal directories.