redis

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CACert = `` /* 6689-byte string literal not displayed */

CACert - hack for redis labs CA issue

View Source
var KeepTTL = redis.KeepTTL

KeepTTL - helper to expose KeepTTL

Functions

This section is empty.

Types

type Client

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

Client - instance created when initializing client

func New

func New(uri string) (Client, error)

New - constructor to create an instance of the client

func NewSecure added in v0.0.5

func NewSecure(uri string, clientCertPath string, clientKeyPath string, skipVerify bool) (Client, error)

NewSecure - constructor to create an instance of the client

func (Client) Del

func (r Client) Del(ctx context.Context, key string) (int64, error)

Del - implementation of redis DEL, ctx can be nil

func (Client) Get

func (r Client) Get(ctx context.Context, key string) (string, error)

Get - implementation of redis GET, ctx can be nil

func (Client) Keys

func (r Client) Keys(ctx context.Context, match string) ([]string, error)

Keys - implementation of redis KEYS, ctx can be nil

func (Client) Lock

func (r Client) Lock(ctx context.Context, key string, ttl time.Duration) (bool, error)

Lock - implementation of redis distributed lock, ctx can be nil

func (Client) Set

func (r Client) Set(ctx context.Context, key string, value string, ttl time.Duration) (string, error)

Set - implementation of redis SET, ctx can be nil

func (Client) SetNX

func (r Client) SetNX(ctx context.Context, key string, value string, ttl time.Duration) (bool, error)

SetNX - implementation of redis SET with NX flag, ctx can be nil

func (Client) TTL added in v0.0.9

func (r Client) TTL(ctx context.Context, key string) (int64, error)

TTL - implementation of redis TTL, ctx can be nil -- returns in time.Duration which is always in nanoseconds; convert to seconds -- it returns -1 (-1ns) when there is no associated expiry -- it returns -2 (-2ns) when there is no key

func (Client) Unlock

func (r Client) Unlock(ctx context.Context, key string) (bool, error)

Unlock - implementation of redis distributed unlock, ctx can be nil

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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