redisx

package
v0.0.0-...-1762b78 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeySupportedSymbols = "supported_symbols"
)

Variables

View Source
var (
	ErrDoesNotExist = errors.New("value does not exist by this key")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	redis.UniversalClient
	// contains filtered or unexported fields
}

Client wraps redis.UniversalClient

func NewClient

func NewClient(opt *Options) *Client

func (*Client) GetBytes

func (c *Client) GetBytes(ctx context.Context, key string) ([]byte, error)

func (*Client) GetString

func (c *Client) GetString(ctx context.Context, key string) (string, error)

func (*Client) GetStruct

func (c *Client) GetStruct(ctx context.Context, key string, target interface{}) error

GetStruct will unmarshal json bytes stored by key to target DEPRECATED

func (*Client) RLTransaction

func (c *Client) RLTransaction(ctx context.Context, lock string, fn func(context.Context, *Client) error) error

RLTransaction performs pessimistic-lock transaction using Redlock algorithm https://redis.io/topics/distlock lock is the name of the lock (i.e. name of redis key used to lock the operation)

func (*Client) SetStruct

func (c *Client) SetStruct(ctx context.Context, key string, any interface{}, ttl time.Duration) error

SetStruct will marshal to json bytes any go struct and save it by key DEPRECATED

type Options

type Options struct {
	Addr     string
	Password string
	DB       int
}

Jump to

Keyboard shortcuts

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