Documentation ¶
Index ¶
- type Cache
- func (c *Cache[K, V]) GetAndSetCacheData(key string, id K, fn func() (V, error)) (value V, err error)
- func (c *Cache[K, V]) GetAndSetCacheMap(key string, ids []K, fn func([]K) (map[K]V, error)) (v map[K]V, err error)
- func (c *Cache[K, V]) GetCacheMap(key string, ids []K) (v map[K]V)
- func (c *Cache[K, V]) GetCacheValue(key string, id K) (value V)
- func (c *Cache[K, V]) SetCacheMap(key string, ids []K, fn func([]K) (map[K]V, error)) (err error)
- func (c *Cache[K, V]) SetCacheValue(key string, id K, fn func() (V, error)) (err error)
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable, V any] struct { Storage[K, V] }
func (*Cache[K, V]) GetAndSetCacheData ¶
func (c *Cache[K, V]) GetAndSetCacheData(key string, id K, fn func() (V, error)) (value V, err error)
GetAndSetCacheData 获取缓存后数据
func (*Cache[K, V]) GetAndSetCacheMap ¶
func (c *Cache[K, V]) GetAndSetCacheMap(key string, ids []K, fn func([]K) (map[K]V, error)) (v map[K]V, err error)
GetAndSetCacheMap 获取缓存后数据 map形式
func (*Cache[K, V]) GetCacheMap ¶
GetCacheMap 获取缓存数据 map形式
func (*Cache[K, V]) GetCacheValue ¶
GetCacheValue 获取缓存数据
func (*Cache[K, V]) SetCacheMap ¶
SetCacheMap 设置缓存数据 map形式
Click to show internal directories.
Click to hide internal directories.