redis

package
v0.34.7 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Error is a redis error
	Error = errs.Class("redis error")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	TTL time.Duration
	// contains filtered or unexported fields
}

Client is the entrypoint into Redis

func NewClient

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

NewClient returns a configured Client instance, verifying a successful connection to redis

func NewClientFrom

func NewClientFrom(address string) (*Client, error)

NewClientFrom returns a configured Client instance from a redis address, verifying a successful connection to redis

func (*Client) Close

func (client *Client) Close() error

Close closes a redis client

func (*Client) CompareAndSwap added in v0.16.0

func (client *Client) CompareAndSwap(ctx context.Context, key storage.Key, oldValue, newValue storage.Value) (err error)

CompareAndSwap atomically compares and swaps oldValue with newValue

func (*Client) Delete

func (client *Client) Delete(ctx context.Context, key storage.Key) (err error)

Delete deletes a key/value pair from redis, for a given the key

func (*Client) DeleteMultiple added in v0.33.2

func (client *Client) DeleteMultiple(ctx context.Context, keys []storage.Key) (_ storage.Items, err error)

DeleteMultiple deletes keys ignoring missing keys

func (*Client) FlushDB

func (client *Client) FlushDB() error

FlushDB deletes all keys in the currently selected DB.

func (*Client) Get

func (client *Client) Get(ctx context.Context, key storage.Key) (_ storage.Value, err error)

Get looks up the provided key from redis returning either an error or the result.

func (*Client) GetAll

func (client *Client) GetAll(ctx context.Context, keys storage.Keys) (_ storage.Values, err error)

GetAll is the bulk method for gets from the redis data store. The maximum keys returned will be LookupLimit. If more than that is requested, an error will be returned

func (*Client) IncrBy added in v0.24.0

func (client *Client) IncrBy(ctx context.Context, key storage.Key, value int64) (err error)

IncrBy increments the value stored in key by the specified value.

func (*Client) Iterate

func (client *Client) Iterate(ctx context.Context, opts storage.IterateOptions, fn func(context.Context, storage.Iterator) error) (err error)

Iterate iterates over items based on opts

func (*Client) List

func (client *Client) List(ctx context.Context, first storage.Key, limit int) (_ storage.Keys, err error)

List returns either a list of keys for which boltdb has values or an error.

func (*Client) LookupLimit added in v0.31.0

func (client *Client) LookupLimit() int

LookupLimit returns the maximum limit that is allowed.

func (*Client) Put

func (client *Client) Put(ctx context.Context, key storage.Key, value storage.Value) (err error)

Put adds a value to the provided key in redis, returning an error on failure.

func (*Client) SetLookupLimit added in v0.31.0

func (client *Client) SetLookupLimit(v int)

SetLookupLimit sets the lookup limit.

type StaticIterator added in v0.34.1

type StaticIterator struct {
	Items storage.Items
	Index int
}

StaticIterator implements an iterator over list of items.

func (*StaticIterator) Next added in v0.34.1

func (it *StaticIterator) Next(ctx context.Context, item *storage.ListItem) bool

Next returns the next item from the iterator.

Directories

Path Synopsis
Package redisserver is package for starting a redis test server
Package redisserver is package for starting a redis test server

Jump to

Keyboard shortcuts

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