redis

package
v1.5.15 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBIsValid

func DBIsValid(rdb *RedisDB) error

check DB is connected

func IsKeyNotExist

func IsKeyNotExist(err error) bool

Types

type Batch

type Batch struct {
	// contains filtered or unexported fields
}

func (*Batch) Commit

func (bt *Batch) Commit() (string, error)

func (*Batch) Delete

func (bt *Batch) Delete(key string)

func (*Batch) Discard

func (bt *Batch) Discard()

func (*Batch) Set

func (bt *Batch) Set(key string, value interface{})

type KVPair

type KVPair struct {
	Key   string
	Value string
}

type KVPairs

type KVPairs []KVPair

func (KVPairs) Len

func (kv KVPairs) Len() int

func (KVPairs) Less

func (kv KVPairs) Less(i, j int) bool

func (KVPairs) Swap

func (kv KVPairs) Swap(i, j int)

type RaftRedisClient

type RaftRedisClient struct {
	*redis.Client
}

func NewRaftRedisClient

func NewRaftRedisClient(opt *redis.Options) *RaftRedisClient

func (*RaftRedisClient) GetKeys

func (client *RaftRedisClient) GetKeys(prefix string, desc bool) (KVPairs, error)

获取前缀为 prefix 的所有键值对 desc 为降序返回

func (*RaftRedisClient) Iter

func (client *RaftRedisClient) Iter(start, end string, desc, withvalues bool, limit int) ([]KVPair, error)

func (*RaftRedisClient) NewBatch

func (client *RaftRedisClient) NewBatch() *Batch

批量提交

type RedisDB

type RedisDB struct {
	DB *RaftRedisClient
	// contains filtered or unexported fields
}

func NewRedisDB

func NewRedisDB(opt *redis.Options) *RedisDB

func (*RedisDB) Close

func (rdb *RedisDB) Close() error

func (*RedisDB) Delete

func (rdb *RedisDB) Delete(key []byte) error

func (*RedisDB) DeleteSync

func (rdb *RedisDB) DeleteSync(key []byte) error

func (*RedisDB) Get

func (rdb *RedisDB) Get(key []byte) ([]byte, error)

/implement DB

func (*RedisDB) Has

func (rdb *RedisDB) Has(key []byte) (bool, error)

func (*RedisDB) Iterator

func (rdb *RedisDB) Iterator(start, end []byte) (db.Iterator, error)

func (*RedisDB) NewBatch

func (rdb *RedisDB) NewBatch() db.Batch

func (*RedisDB) NewRedisIterator

func (rdb *RedisDB) NewRedisIterator(start, end []byte, isReserve bool, withValue bool, limit int) db.Iterator

func (*RedisDB) Print

func (rdb *RedisDB) Print() error

func (*RedisDB) ReverseIterator

func (rdb *RedisDB) ReverseIterator(start, end []byte) (db.Iterator, error)

func (*RedisDB) Set

func (rdb *RedisDB) Set(key, value []byte) error

func (*RedisDB) SetSync

func (rdb *RedisDB) SetSync(key, value []byte) error

func (*RedisDB) Stats

func (rdb *RedisDB) Stats() map[string]string

type RedisIterator

type RedisIterator struct {
	// contains filtered or unexported fields
}

func (*RedisIterator) Close

func (ri *RedisIterator) Close() error

func (*RedisIterator) Domain

func (ri *RedisIterator) Domain() (start, end []byte)

func (*RedisIterator) Error

func (ri *RedisIterator) Error() error

func (*RedisIterator) Key

func (ri *RedisIterator) Key() (key []byte)

func (*RedisIterator) Next

func (ri *RedisIterator) Next()

func (*RedisIterator) Valid

func (ri *RedisIterator) Valid() bool

func (*RedisIterator) Value

func (ri *RedisIterator) Value() (value []byte)

Jump to

Keyboard shortcuts

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