redis

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client struct holds connection to redis

func NewClient

func NewClient(opts *ClientOptions) *Client

NewClient method will return a pointer to new client object

func (*Client) Close

func (c *Client) Close()

Close method closes the redis connection

func (*Client) Del

func (c *Client) Del(key string)

Del method will remove single key from redis

func (*Client) DelMulti

func (c *Client) DelMulti(keys []string)

DelMulti method will remove multiple keys from redis

func (*Client) GetConn

func (c *Client) GetConn() *redis.Client

GetConn returns a pointer to the underlying redis library

func (*Client) HGetAll

func (c *Client) HGetAll(key string) map[string]string

HGetAll will return the hash map

func (*Client) HIncrBy

func (c *Client) HIncrBy(key, field string, inc int64) int64

HIncrBy will increment a hash map key

type ClientOptions

type ClientOptions struct {
	Host            string
	Port            string
	Password        string
	MaxRetries      int
	MinRetryBackOff time.Duration
	MaxRetryBackOff time.Duration
	WriteTimeout    time.Duration
	DB              int
	PoolSize        int
}

ClientOptions struct contains the options for connecting to redis

type Clientv2

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

Clientv2 struct holds pool connection to redis using radix dep

func NewV2Client

func NewV2Client(opts *ClientOptions) *Clientv2

NewV2Client will return the pool connection to radix object

func (*Clientv2) Close

func (c *Clientv2) Close()

Close method closes the redis connection

func (*Clientv2) HIncrBy

func (c *Clientv2) HIncrBy(key, field string, inc int64)

HIncrBy will increment a hash map key

func (*Clientv2) HIncrByFloat

func (c *Clientv2) HIncrByFloat(key, field string, inc float64)

HIncrByFloat will increment a hash map key

func (*Clientv2) SAdd

func (c *Clientv2) SAdd(key, field string) int

SAdd will add the member to the set

func (*Clientv2) SCard

func (c *Clientv2) SCard(key string) int

SCard will get the size of set

func (*Clientv2) SIsMember

func (c *Clientv2) SIsMember(key, val string) int

SIsMember will will check if value is in the set

Jump to

Keyboard shortcuts

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