Documentation
¶
Index ¶
- Constants
- Variables
- func CloseMemory()
- func Del(keys ...string) error
- func Delete(key string) error
- func Expire(key string, expiration time.Duration) error
- func Get(key string) (any, error)
- func InitMemory()
- func InitMemoryWithSize(maxSize int)
- func Keys(pattern string) ([]string, error)
- func SAdd(key string, members ...any) error
- func SCard(key string) (int64, error)
- func Set(key string, value any, expiration time.Duration) error
- type MemoryCache
Constants ¶
View Source
const DefaultMaxSize = 10000
DefaultMaxSize 默认最大缓存条目数
Variables ¶
View Source
var ErrKeyNotFound = errors.New("key not found")
ErrKeyNotFound 键不存在错误
Functions ¶
Types ¶
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache 内存缓存实现(支持 TTL、LRU 淘汰、定期清理)
Click to show internal directories.
Click to hide internal directories.