Documentation
¶
Index ¶
- type CacheMap
- func (cache *CacheMap[K, V]) Del(key K)
- func (cache *CacheMap[K, V]) DelOld(cacheTime time.Duration)
- func (cache *CacheMap[K, V]) Expire(exp time.Duration) bool
- func (cache *CacheMap[K, V]) ForEach(cb func(key K, value V) bool, touch ...bool)
- func (cache *CacheMap[K, V]) Get(key K) (V, error)
- func (cache *CacheMap[K, V]) Has(key K) bool
- func (cache *CacheMap[K, V]) Set(key K, value V, err error)
- func (cache *CacheMap[K, V]) Touch(key K) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheMap ¶
func NewCacheCB ¶
NewCacheCB is just like the NewCache method, but it returns the loop in a callback function, to avoid creating more goroutines
func (*CacheMap[K, V]) Del ¶
func (cache *CacheMap[K, V]) Del(key K)
Del removes a cache item by key
func (*CacheMap[K, V]) ForEach ¶
ForEach runs a callback function for each cache item that has not expired
in the callback, return true to continue, and false to break the loop
func (*CacheMap[K, V]) Get ¶
Get returns a value or an error if it exists
if the object key does not exist, it will return both a nil/zero value (of the relevant type) and nil error
Click to show internal directories.
Click to hide internal directories.