redix

package
v0.0.0-...-9654843 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithContext

func WithContext(ctx context.Context) redisOption

Types

type RedisClient

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

func New

func New(url string, opts ...redisOption) (*RedisClient, error)

func NewCluster

func NewCluster(url string, opts ...redisOption) (*RedisClient, error)

func NewRing

func NewRing(url string, opts ...redisOption) (*RedisClient, error)

func NewSentinel

func NewSentinel(url string, opts ...redisOption) (*RedisClient, error)

func (*RedisClient) Del

func (this *RedisClient) Del(keys ...string) (int64, error)

Delete the values by key or keys

func (*RedisClient) Dump

func (this *RedisClient) Dump(key string) (string error)

dump the values of key

func (*RedisClient) Exists

func (this *RedisClient) Exists(keys ...string) (int64, error)

Check the keys if exists

func (*RedisClient) Expire

func (this *RedisClient) Expire(key string, expiration time.Duration) (bool, error)

expire, pexpire

func (*RedisClient) ExpireAt

func (this *RedisClient) ExpireAt(key string, tm time.Time) (bool, error)

expireat, pexpireat

func (*RedisClient) Get

func (this *RedisClient) Get(key string) (string, error)

Get the value by key

func (*RedisClient) GetSet

func (this *RedisClient) GetSet(key string, value interface{}) (string, error)

GetSet

func (*RedisClient) Keys

func (this *RedisClient) Keys(pattern string) ([]string, error)

Search all keys by pattern

func (*RedisClient) MGet

func (this *RedisClient) MGet(keys ...string) ([]interface{}, error)

Get the values for Multiple Keys

func (*RedisClient) MSet

func (this *RedisClient) MSet(values ...interface{}) (bool, error)

Set values for Multiple Keys or accept a Map with string keys

func (*RedisClient) Move

func (this *RedisClient) Move(key string, db int) (bool, error)

Move key to database ID

func (*RedisClient) PExpire

func (this *RedisClient) PExpire(key string, expiration time.Duration) (bool, error)

func (*RedisClient) PExpireAt

func (this *RedisClient) PExpireAt(key string, tm time.Time) (bool, error)

func (*RedisClient) PTTL

func (this *RedisClient) PTTL(key string) (time.Duration, error)

func (*RedisClient) Persist

func (this *RedisClient) Persist(key string) (bool, error)

persist

func (*RedisClient) RandomKey

func (this *RedisClient) RandomKey() (string, error)

Get a random key from current database

func (*RedisClient) Rename

func (this *RedisClient) Rename(key string, newKey string) (bool error)

Rename whether newKey exists or not, this will be work!

func (*RedisClient) RenameNX

func (this *RedisClient) RenameNX(key string, newKey string) (bool error)

RenameNX only works when newKey doesn't exist

func (*RedisClient) Set

func (this *RedisClient) Set(key string, value interface{}, expirations ...time.Duration) error

Set the value for key @key - string @value - interface{} @seconds - the seconds of expiration (optional, by default it wont be expired forever)

func (*RedisClient) SetEX

func (this *RedisClient) SetEX(key string, value interface{}, expiration time.Duration) error

Set the value for key with expiration

func (*RedisClient) SetNX

func (this *RedisClient) SetNX(key string, value interface{}, expiration time.Duration) error

Set the value for key with expiration if value exists, it wont overwrite the old value

func (*RedisClient) TTL

func (this *RedisClient) TTL(key string) (time.Duration, error)

ttl,pttl

func (*RedisClient) Type

func (this *RedisClient) Type(key string) (string, error)

type

func (this *RedisClient) Unlink(keys ...string) (int64, error)

Delete the values by key or keys

Jump to

Keyboard shortcuts

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