redis

package
v0.0.0-...-66d3767 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// user session key, param is sid
	KEY_USER_SESSION = "app:session:%s"
	// key for insert user lock to prevent concurrent insert, first param is email, second is username
	KEY_INSERT_USER_LOCK = "app:i:u:lock:%s:%s"
)

Variables

This section is empty.

Functions

func Init

func Init()

Types

type Client

type Client redis.Client
var Cli Client

func NewClient

func NewClient(address string, password string, db int) (Client, error)

func (*Client) Del

func (client *Client) Del(ctx context.Context, key string)

func (*Client) Get

func (client *Client) Get(ctx context.Context, key string) *redis.StringCmd

func (*Client) ObtainLock

func (client *Client) ObtainLock(key string, expiration time.Duration) error

func (*Client) Publish

func (client *Client) Publish(ctx context.Context, channel string, message interface{}) error

func (*Client) ReleaseLock

func (client *Client) ReleaseLock(key string)

func (*Client) Set

func (client *Client) Set(ctx context.Context, key string, value interface{}, expiration time.Duration)

func (*Client) Subscribe

func (client *Client) Subscribe(ctx context.Context, channels ...string) *redis.PubSub

Jump to

Keyboard shortcuts

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