Documentation
¶
Index ¶
- type Badger
- func (b *Badger) Close(ctx context.Context) error
- func (b *Badger) Del(ctx context.Context, key string) error
- func (b *Badger) Exists(ctx context.Context, key string) (bool, error)
- func (b *Badger) Get(ctx context.Context, key string) (string, error)
- func (b *Badger) Increment(ctx context.Context, key string, value int64, ttl ...time.Duration) (int64, error)
- func (b *Badger) Set(ctx context.Context, key, value string, ttl ...time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Badger ¶
type Badger struct {
// contains filtered or unexported fields
}
func (*Badger) Increment ¶
func (b *Badger) Increment(ctx context.Context, key string, value int64, ttl ...time.Duration) (int64, error)
Increment 实现类似于redis中Incr命令 TODO: 1.目前badger得过期时间是使用本地时区时间,因此上游设置时间同样也需要使用本地时区时间,不然会造成不符合预期结果。 2.由于badger支持有限,因此在设置过期时间后,更新操作需要每次自己计算过期时间,如果不指定过期时间则相当移除了过期时间。 3.是否存在并发问题有待商榷
Click to show internal directories.
Click to hide internal directories.