Documentation ¶ Index ¶ type Cache func NewCache(expTime time.Duration) (*Cache, error) func (i *Cache) Close() error func (i *Cache) Delete(key string) error func (i *Cache) Get(key string, v any) error func (i *Cache) Len() int func (i *Cache) Reset() error func (i *Cache) Set(key string, value any) error Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type Cache ¶ type Cache struct { BigCache *bigcache.BigCache } func NewCache ¶ func NewCache(expTime time.Duration) (*Cache, error) NewCache 初始化带时间过期的缓存,0为永不过期 func (*Cache) Close ¶ func (i *Cache) Close() error Close 关闭缓存 func (*Cache) Delete ¶ func (i *Cache) Delete(key string) error Delete 删除 func (*Cache) Get ¶ func (i *Cache) Get(key string, v any) error Get 传入key 和 v指针,返回相应类型 func (*Cache) Len ¶ func (i *Cache) Len() int Len 当前缓存长度 func (*Cache) Reset ¶ func (i *Cache) Reset() error Reset 重置缓存 func (*Cache) Set ¶ func (i *Cache) Set(key string, value any) error Set 将指定的key存储到缓存中 Source Files ¶ View all Source files cache.go Click to show internal directories. Click to hide internal directories.