Documentation
¶
Overview ¶
@Author daixk 2025/12/22 15:56:00
Index ¶
- Constants
- Variables
- type Storage
- func (s *Storage) Clear(_ context.Context) error
- func (s *Storage) Delete(_ context.Context, keys ...string) error
- func (s *Storage) Exists(_ context.Context, key string) bool
- func (s *Storage) Expire(_ context.Context, key string, expiration time.Duration) error
- func (s *Storage) Get(_ context.Context, key string) (any, error)
- func (s *Storage) GetAndDelete(_ context.Context, key string) (any, error)
- func (s *Storage) Keys(_ context.Context, pattern string) ([]string, error)
- func (s *Storage) Ping(_ context.Context) error
- func (s *Storage) Set(_ context.Context, key string, value any, expiration time.Duration) error
- func (s *Storage) TTL(_ context.Context, key string) (time.Duration, error)
Constants ¶
View Source
const ( TTLNoExpire = adapter.TTLNoExpire TTLNotFound = adapter.TTLNotFound )
TTL constants define memory TTL sentinel values TTL 常量定义内存 TTL 哨兵值
Variables ¶
View Source
var ErrKeyNotFound = errors.New("key not found")
ErrKeyNotFound indicates the key is missing or expired 表示键不存在或已过期。
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage implements in-memory storage with go-cache 基于 go-cache 的内存存储实现。
func NewStorage ¶
func NewStorage() *Storage
NewStorage creates a new memory storage instance 创建一个新的内存存储实例
func (*Storage) GetAndDelete ¶
GetAndDelete atomically gets and deletes a key 原子地获取并删除指定键
Click to show internal directories.
Click to hide internal directories.