tempdb: github.com/rafaeljesus/tempdb Index | Files

package tempdb

import "github.com/rafaeljesus/tempdb"


Package Files



var (
    // ErrKeyRequired is returned when key is not passed as parameter in tempdb.Config.
    ErrKeyRequired = errors.New("creating a new tempdb requires a non-empty key")
    // ErrValueRequired is returned when value is not passed as parameter in tempdb.Config.
    ErrValueRequired = errors.New("creating a new tempdb requires a non-empty value")

type Options Uses

type Options struct {
    Network            string
    Addr               string
    Dialer             func() (net.Conn, error)
    Password           string
    DB                 int
    MaxRetries         int
    DialTimeout        time.Duration
    ReadTimeout        time.Duration
    WriteTimeout       time.Duration
    PoolSize           int
    PoolTimeout        time.Duration
    IdleTimeout        time.Duration
    IdleCheckFrequency time.Duration
    ReadOnly           bool
    TLSConfig          *tls.Config

Options carries the different variables to tune a newly started redis client, it exposes the same configuration available from https://godoc.org/gopkg.in/redis.v5#Options go client.

type Tempdb Uses

type Tempdb struct {

Tempdb stores an expiring (or non-expiring) key/value pair in Redis.

func New Uses

func New(o Options) (*Tempdb, error)

New returns a new temp configured with the variables from the options parameter, or returning an non-nil err if an error occurred while creating redis client.

func (*Tempdb) Find Uses

func (t *Tempdb) Find(key string) (string, error)

Find the value associated with the key.

func (*Tempdb) Insert Uses

func (t *Tempdb) Insert(key, value string, expires time.Duration) error

Insert a key/value pair with an optional expiration time.

Package tempdb imports 6 packages (graph). Updated 2018-02-17. Refresh now. Tools for package owners.