Documentation ¶
Index ¶
- func WithContext(ctx context.Context) redisOption
- type RedisClient
- func (this *RedisClient) Del(keys ...string) (int64, error)
- func (this *RedisClient) Dump(key string) (string error)
- func (this *RedisClient) Exists(keys ...string) (int64, error)
- func (this *RedisClient) Expire(key string, expiration time.Duration) (bool, error)
- func (this *RedisClient) ExpireAt(key string, tm time.Time) (bool, error)
- func (this *RedisClient) Get(key string) (string, error)
- func (this *RedisClient) GetSet(key string, value interface{}) (string, error)
- func (this *RedisClient) Keys(pattern string) ([]string, error)
- func (this *RedisClient) MGet(keys ...string) ([]interface{}, error)
- func (this *RedisClient) MSet(values ...interface{}) (bool, error)
- func (this *RedisClient) Move(key string, db int) (bool, error)
- func (this *RedisClient) PExpire(key string, expiration time.Duration) (bool, error)
- func (this *RedisClient) PExpireAt(key string, tm time.Time) (bool, error)
- func (this *RedisClient) PTTL(key string) (time.Duration, error)
- func (this *RedisClient) Persist(key string) (bool, error)
- func (this *RedisClient) RandomKey() (string, error)
- func (this *RedisClient) Rename(key string, newKey string) (bool error)
- func (this *RedisClient) RenameNX(key string, newKey string) (bool error)
- func (this *RedisClient) Set(key string, value interface{}, expirations ...time.Duration) error
- func (this *RedisClient) SetEX(key string, value interface{}, expiration time.Duration) error
- func (this *RedisClient) SetNX(key string, value interface{}, expiration time.Duration) error
- func (this *RedisClient) TTL(key string) (time.Duration, error)
- func (this *RedisClient) Type(key string) (string, error)
- func (this *RedisClient) Unlink(keys ...string) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithContext ¶
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) 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) 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
Click to show internal directories.
Click to hide internal directories.