Documentation
¶
Index ¶
- func InitRedis(ctx context.Context)
- type AppConfigLoadedEventListener
- type AppShutDownEventListener
- type Client
- func (r *Client) Close() error
- func (r *Client) Del(key string) error
- func (r *Client) Get(key string) (string, error)
- func (r *Client) HGet(key, field string) (string, error)
- func (r *Client) HSet(key, field, value string) error
- func (r *Client) LPush(key, value string) error
- func (r *Client) LRange(key string, start, end int64) ([]string, error)
- func (r *Client) Set(key, value string, expiration time.Duration) error
- func (r *Client) SetNX(key, value string, expiration time.Duration) (bool, error)
- type DistributedLock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppConfigLoadedEventListener ¶
type AppConfigLoadedEventListener struct{}
func (*AppConfigLoadedEventListener) GetOrder ¶
func (ace *AppConfigLoadedEventListener) GetOrder() int
func (*AppConfigLoadedEventListener) OnApplicationEvent ¶
func (ace *AppConfigLoadedEventListener) OnApplicationEvent(ctx context.Context, event *listener.AppConfigLoadedEvent)
type AppShutDownEventListener ¶
type AppShutDownEventListener struct{}
func (*AppShutDownEventListener) GetOrder ¶
func (l *AppShutDownEventListener) GetOrder() int
func (*AppShutDownEventListener) OnApplicationEvent ¶
func (l *AppShutDownEventListener) OnApplicationEvent(ctx context.Context, event *listener.AppShutdownEvent)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client Redis客户端结构体
type DistributedLock ¶
type DistributedLock struct {
// contains filtered or unexported fields
}
DistributedLock 分布式锁结构体
func NewDistributedLock ¶
func NewDistributedLock(key string, expiration time.Duration) *DistributedLock
NewDistributedLock 创建分布式锁实例
func (*DistributedLock) Lock ¶
func (l *DistributedLock) Lock(ctx context.Context) (bool, error)
Lock 获取分布式锁
Click to show internal directories.
Click to hide internal directories.