Documentation ¶
Index ¶
- func CloseCache()
- type Cache
- type DiskCache
- func (d *DiskCache) Add(key any, value any, lifeSpan time.Duration)
- func (d *DiskCache) Clear() bool
- func (d *DiskCache) Close()
- func (d *DiskCache) Delete(key any)
- func (d *DiskCache) Get(key any) (any, bool)
- func (d *DiskCache) IsExist(key any) bool
- func (d *DiskCache) Range(f func(key, value any) bool)
- func (d *DiskCache) Set(key any, value any, duration time.Duration)
- func (d *DiskCache) Value(key any) (any, bool)
- type ICache
- type MemCache
- func (c *MemCache) Add(key any, value any, lifeSpan time.Duration)
- func (c *MemCache) Clear() bool
- func (cache *MemCache) Close()
- func (cache *MemCache) Delete(key any)
- func (cache *MemCache) Get(key any) (any, bool)
- func (c *MemCache) IsExist(key any) bool
- func (cache *MemCache) Range(f func(key, value any) bool)
- func (cache *MemCache) Set(key any, value any, duration time.Duration)
- func (c *MemCache) Value(key any) (any, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseCache ¶ added in v1.19.41
func CloseCache()
Types ¶
type DiskCache ¶ added in v1.19.42
type DiskCache struct {
// contains filtered or unexported fields
}
type ICache ¶ added in v1.19.42
type ICache interface { Add(key any, value any, lifeSpan time.Duration) Value(key any) (any, bool) IsExist(key any) bool Clear() bool Get(key any) (any, bool) Set(key any, value any, duration time.Duration) Range(f func(key, value any) bool) Delete(key any) Close() }
func OnDiskCache ¶ added in v1.19.41
func OnGetCache ¶
初始化一个cache cachename 缓存名字
func OnMemCache ¶ added in v1.19.42
type MemCache ¶ added in v1.19.42
type MemCache struct {
// contains filtered or unexported fields
}
func New ¶ added in v1.1.15
New creates a new cache that asynchronously cleans expired entries after the given time passes.
func (*MemCache) Close ¶ added in v1.19.42
func (cache *MemCache) Close()
Close closes the cache and frees up resources.
func (*MemCache) Range ¶ added in v1.19.42
Range calls f sequentially for each key and value present in the cache. If f returns false, range stops the iteration.
Click to show internal directories.
Click to hide internal directories.