Documentation
¶
Index ¶
- Constants
- Variables
- func Clear()
- func CloseMemory()
- func Decr(key string) int64
- func Del(keys ...string) error
- func Delete(key string) error
- func Exists(key string) bool
- func Expire(key string, expiration time.Duration) error
- func Get(key string) (any, error)
- func GetInt(key string) (int64, error)
- func GetString(key string) (string, error)
- func HDel(key string, fields ...string) error
- func HGet(key string, field string) (string, error)
- func HGetAll(key string) (map[string]string, error)
- func HSet(key string, field string, value any) error
- func Incr(key string) int64
- func IncrBy(key string, delta int64) int64
- func InitMemory()
- func InitMemoryWithSize(maxSize int)
- func IsMemoryCache() bool
- func IsRedisCache() bool
- func Keys(pattern string) ([]string, error)
- func Len() int
- func SAdd(key string, members ...any) error
- func SCard(key string) (int64, error)
- func SClear(key string) error
- func SMembers(key string) ([]string, error)
- func Set(key string, value any, expiration time.Duration) error
- func SetInt(key string, value int64, expiration time.Duration) error
- func StartCleanup()
- func Stop()
- type CacheType
- 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.