Documentation ¶
Index ¶
- Variables
- func Client() *rkv
- func Close() error
- func Init(opts ...func(o *Options)) error
- func NewClient(opts ...func(o *Options)) (*rkv, error)
- type ClientType
- type DelOptions
- type ExpireOptions
- type GetOptions
- type Input
- type Key
- type Mutex
- func (r Mutex) Close() error
- func (r Mutex) Del(key string, opts ...func(o *DelOptions)) error
- func (r Mutex) Expire(key string, opts ...func(o *ExpireOptions)) error
- func (r Mutex) Get(key string, opts ...func(o *GetOptions)) (Output, error)
- func (r Mutex) IsExists(key string, opts ...func(o *GetOptions)) bool
- func (m *Mutex) Lock()
- func (r Mutex) Mutex(key string, opts ...func(o *MutexOptions)) *Mutex
- func (r Mutex) Set(rec *Input, opts ...func(o *SetOptions)) error
- func (m *Mutex) Unlock()
- type MutexOptions
- type Options
- type Output
- type SetOptions
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type ClientType ¶
type ClientType string
const ( RedisClient ClientType = "client" RedisCluster ClientType = "cluster" )
type ExpireOptions ¶
type ExpireOptions struct { Context context.Context // TTL key 过期时间 TTL time.Duration // Expiry key 过期时间。TTL 和 Expiry 同时设置时,以 Expiry 为准 Expiry time.Time }
ExpireOptions .
type GetOptions ¶
type GetOptions struct { Context context.Context // Marshaler value 编码方式 Marshaler codec.Marshaler }
GetOptions .
type Mutex ¶
type Mutex struct {
// contains filtered or unexported fields
}
Mutex redis 分布式锁
func (Mutex) Expire ¶
func (r Mutex) Expire(key string, opts ...func(o *ExpireOptions)) error
Expire .
func (Mutex) Get ¶
func (r Mutex) Get(key string, opts ...func(o *GetOptions)) (Output, error)
Get .
func (Mutex) IsExists ¶
func (r Mutex) IsExists(key string, opts ...func(o *GetOptions)) bool
IsExists .
type MutexOptions ¶
type MutexOptions struct { Context context.Context // Mark 分布式锁标记 Mark string // Heartbeat 尝试获取锁的时间间隔 Heartbeat time.Duration // TTL 超时时间 TTL time.Duration }
MutexOptions .
type Options ¶
type Options struct { Context context.Context // Type client or cluster Type ClientType Addrs []string Username string Password string // Timeout second Timeout time.Duration // MaxRetries 命令执行失败时的重试次数 MaxRetries int }
Options .
Click to show internal directories.
Click to hide internal directories.