redis

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2019 License: AGPL-3.0 Imports: 7 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) Delete

func (client *Client) Delete(key storage.Key) error

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

func (*Client) FlushDB

func (client *Client) FlushDB() error

FlushDB deletes all keys in the currently selected DB.

func (*Client) Get

func (client *Client) Get(key storage.Key) (storage.Value, error)

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

func (*Client) GetAll

func (client *Client) GetAll(keys storage.Keys) (storage.Values, error)

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

func (*Client) Iterate

func (client *Client) Iterate(opts storage.IterateOptions, fn func(it storage.Iterator) error) error

Iterate iterates over items based on opts

func (*Client) List

func (client *Client) List(first storage.Key, limit int) (storage.Keys, error)

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

func (*Client) Put

func (client *Client) Put(key storage.Key, value storage.Value) error

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

type Queue

type Queue Client

Queue is the aliased entrypoint into Redis

func NewQueue

func NewQueue(address, password string, db int) (*Queue, error)

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

func NewQueueFrom

func NewQueueFrom(address string) (*Queue, error)

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

func (*Queue) Close

func (client *Queue) Close() error

Close closes a redis client

func (*Queue) Dequeue

func (client *Queue) Dequeue() (storage.Value, error)

Dequeue removes a FIFO element, for the storage.Queue interface

func (*Queue) Enqueue

func (client *Queue) Enqueue(value storage.Value) error

Enqueue add a FIFO element, for the storage.Queue interface

func (*Queue) Peekqueue

func (client *Queue) Peekqueue(limit int) ([]storage.Value, error)

Peekqueue returns upto 1000 entries in the queue without removing

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