badger

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

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 New

func New(path string) (*Badger, error)

func (*Badger) Close

func (b *Badger) Close(ctx context.Context) error

func (*Badger) Del

func (b *Badger) Del(ctx context.Context, key string) error

func (*Badger) Exists

func (b *Badger) Exists(ctx context.Context, key string) (bool, error)

func (*Badger) Get

func (b *Badger) Get(ctx context.Context, key string) (string, error)

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.是否存在并发问题有待商榷

func (*Badger) Set

func (b *Badger) Set(ctx context.Context, key, value string, ttl ...time.Duration) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL