package
Version:
v1.5.5
Opens a new window with list of versions in this module.
Published: Jan 4, 2023
License: Apache-2.0
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
Documentation
¶
Cache is a TTL LRU cache which caches items with a max time to live and with
bounded length.
func (ttlCache *Cache) Add(key interface{}, val interface{}) bool
Add will add a value for a given key.
func (ttlCache *Cache) Get(key interface{}) (value interface{}, ok bool)
Get returns a value and a bool indicating the value was found for a given key.
func (ttlCache *Cache) Peek(key interface{}) (value interface{}, expiration time.Time, ok bool)
Peek will fetch an item from the cache, but will not update the expiration time.
type Cacher interface {
Get(key interface{}) (value interface{}, ok bool)
Add(key interface{}, value interface{}) (evicted bool)
Remove(key interface{}) (ok bool)
}
Cacher describes a basic cache.
type PeekingCacher interface {
Cacher
Peek(key interface{}) (value interface{}, expiration time.Time, ok bool)
}
PeekingCacher describes a basic cache with the ability to peek.
New creates a new TTL LRU cache which caches items with a max time to live and with
bounded length.
Source Files
¶
Directories
¶
Package mock_ttllru is a generated GoMock package.
|
Package mock_ttllru is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.