Documentation
¶
Overview ¶
buntdb包:基于BuntDB的高性能内存缓存实现 提供键值存储、哈希表操作、队列操作和事务支持
BuntDB是一个快速的内存数据库,适用于需要高性能读写的场景 本包实现了Cache接口,提供统一的缓存操作API
主要特性: - 纯内存存储,读写性能极佳 - 支持持久化到文件 - 支持TTL过期 - 队列操作(FIFO/LIFO) - 哈希表操作 - 事务支持 - 线程安全
作者: gophertool
Index ¶
- func NewBuntStore(config config.Cache) (_interface.Cache, error)
- type BuntDb
- func (b *BuntDb) BeginTx() (_interface.Tx, error)
- func (b *BuntDb) Close()
- func (b *BuntDb) Delete(key string) error
- func (b *BuntDb) Exists(key string) (bool, error)
- func (b *BuntDb) Expire(key string, ttl time.Duration) error
- func (b *BuntDb) Get(key string) (string, error)
- func (b *BuntDb) HDel(key, field string) error
- func (b *BuntDb) HGet(key, field string) (string, error)
- func (b *BuntDb) HGetAll(key string) (map[string]string, error)
- func (b *BuntDb) HSet(key, field, value string, ttl time.Duration) error
- func (b *BuntDb) LPop(key string) (string, error)
- func (b *BuntDb) LPush(key string, value string) error
- func (b *BuntDb) Len(key string) (int64, error)
- func (b *BuntDb) Pop(key string) (string, error)
- func (b *BuntDb) PopAll(key string) ([]string, error)
- func (b *BuntDb) Push(key string, value string) error
- func (b *BuntDb) RPop(key string) (string, error)
- func (b *BuntDb) RPush(key string, value string) error
- func (b *BuntDb) Set(key string, value string, ttl time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBuntStore ¶
func NewBuntStore(config config.Cache) (_interface.Cache, error)
Types ¶
type BuntDb ¶
type BuntDb struct {
// contains filtered or unexported fields
}
BuntDb BuntDB缓存实现结构体
func (*BuntDb) Get ¶
Get 获取指定key的值 参数:
key - 键名
返回值:
string - 键对应的值 error - 操作错误,键不存在时返回ErrKeyNotFound
func (*BuntDb) LPop ¶
LPop 弹出列表头部元素 参数:
key - 列表键名
返回值:
string - 弹出的元素值 error - 操作错误,列表为空时返回ErrKeyNotFound
Click to show internal directories.
Click to hide internal directories.