redis

package
v4.2.1-0...-85e7c47 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Del(keys ...string) Result
	Exists(keys ...string) Result
	Get(key string) Result
	Set(key string, value interface{}, expiration time.Duration) Result
	Ping() Result
	Keys(pattern string) Result
	SMembers(key string) Result
	SIsMember(key string, member interface{}) Result
	SAdd(key string, members ...interface{}) Result
	SRem(key string, members ...interface{}) Result
	Incr(key string) Result
	Decr(key string) Result
	RPush(key string, values ...interface{}) Result
	LRange(key string, start, stop int64) Result
	LTrim(key string, start, stop int64) Result
	LLen(key string) Result
	Expire(key string, value time.Duration) Result
	TTL(key string) Result
	MGet(keys []string) Result
	SCard(key string) Result
	Eval(script string, keys []string, args ...interface{}) Result
	HIncrBy(key string, field string, value int64) Result
	HGetAll(key string) Result
}

Client interface which specifies the currently used subset of redis operations

func NewClient

func NewClient(options *UniversalOptions) (Client, error)

NewClient returns new client implementation

type ClientImpl

type ClientImpl struct {
	// contains filtered or unexported fields
}

ClientImpl wrapps redis client

func (*ClientImpl) Decr

func (c *ClientImpl) Decr(key string) Result

Decr implements Decr wrapper for redis

func (*ClientImpl) Del

func (c *ClientImpl) Del(keys ...string) Result

Del implements Del wrapper for redis

func (*ClientImpl) Eval

func (c *ClientImpl) Eval(script string, keys []string, args ...interface{}) Result

Eval implements Eval wrapper for redis

func (*ClientImpl) Exists

func (c *ClientImpl) Exists(keys ...string) Result

Exists implements Exists wrapper for redis

func (*ClientImpl) Expire

func (c *ClientImpl) Expire(key string, value time.Duration) Result

Expire implements Expire wrapper for redis

func (*ClientImpl) Get

func (c *ClientImpl) Get(key string) Result

Get implements Get wrapper for redis

func (*ClientImpl) HGetAll

func (c *ClientImpl) HGetAll(key string) Result

HGetAll implements HGetAll wrapper for redis

func (*ClientImpl) HIncrBy

func (c *ClientImpl) HIncrBy(key string, field string, value int64) Result

HIncrBy implements HIncrBy wrapper for redis

func (*ClientImpl) Incr

func (c *ClientImpl) Incr(key string) Result

Incr implements Incr wrapper for redis

func (*ClientImpl) Keys

func (c *ClientImpl) Keys(pattern string) Result

Keys implements Keys wrapper for redis

func (*ClientImpl) LLen

func (c *ClientImpl) LLen(key string) Result

LLen implements LLen wrapper for redis

func (*ClientImpl) LRange

func (c *ClientImpl) LRange(key string, start, stop int64) Result

LRange implements LRange wrapper for redis

func (*ClientImpl) LTrim

func (c *ClientImpl) LTrim(key string, start, stop int64) Result

LTrim implements LTrim wrapper for redis

func (*ClientImpl) MGet

func (c *ClientImpl) MGet(keys []string) Result

MGet implements MGet wrapper for redis

func (*ClientImpl) Ping

func (c *ClientImpl) Ping() Result

Ping implements Ping wrapper for redis

func (*ClientImpl) RPush

func (c *ClientImpl) RPush(key string, values ...interface{}) Result

RPush implements RPush wrapper for redis

func (*ClientImpl) SAdd

func (c *ClientImpl) SAdd(key string, members ...interface{}) Result

SAdd implements SAdd wrapper for redis

func (*ClientImpl) SCard

func (c *ClientImpl) SCard(key string) Result

SCard implements SCard wrapper for redis

func (*ClientImpl) SIsMember

func (c *ClientImpl) SIsMember(key string, member interface{}) Result

SIsMember implements SIsMember wrapper for redis

func (*ClientImpl) SMembers

func (c *ClientImpl) SMembers(key string) Result

SMembers implements SMembers wrapper for redis

func (*ClientImpl) SRem

func (c *ClientImpl) SRem(key string, members ...interface{}) Result

SRem implements SRem wrapper for redis

func (*ClientImpl) Set

func (c *ClientImpl) Set(key string, value interface{}, expiration time.Duration) Result

Set implements Set wrapper for redis

func (*ClientImpl) TTL

func (c *ClientImpl) TTL(key string) Result

TTL implements TTL wrapper for redis

type PrefixedRedisClient

type PrefixedRedisClient struct {
	Prefix string
	Client Client
}

PrefixedRedisClient struct

func NewPrefixedRedisClient

func NewPrefixedRedisClient(redisClient Client, prefix string) (*PrefixedRedisClient, error)

NewPrefixedRedisClient returns a new Prefixed Redis Client

func (*PrefixedRedisClient) Decr

func (p *PrefixedRedisClient) Decr(key string) (int64, error)

Decr increments a key. Sets it in one if it doesn't exist

func (*PrefixedRedisClient) Del

func (p *PrefixedRedisClient) Del(keys ...string) (int64, error)

Del wraps around redis del method by adding prefix and returning int64 and error directly

func (*PrefixedRedisClient) Eval

func (p *PrefixedRedisClient) Eval(script string, keys []string, args ...interface{}) error

Eval implements Eval wrapper for redis

func (*PrefixedRedisClient) Exists

func (p *PrefixedRedisClient) Exists(keys ...string) (int64, error)

Exists returns true if a key exists in redis

func (*PrefixedRedisClient) Expire

func (p *PrefixedRedisClient) Expire(key string, value time.Duration) bool

Expire set expiration time for particular key

func (*PrefixedRedisClient) Get

func (p *PrefixedRedisClient) Get(key string) (string, error)

Get wraps around redis get method by adding prefix and returning string and error directly

func (*PrefixedRedisClient) HGetAll

func (p *PrefixedRedisClient) HGetAll(key string) (map[string]string, error)

HGetAll implements HGetAll wrapper for redis

func (*PrefixedRedisClient) HIncrBy

func (p *PrefixedRedisClient) HIncrBy(key string, field string, value int64) (int64, error)

HIncrBy implements HIncrBy wrapper for redis

func (*PrefixedRedisClient) Incr

func (p *PrefixedRedisClient) Incr(key string) (int64, error)

Incr increments a key. Sets it in one if it doesn't exist

func (*PrefixedRedisClient) Keys

func (p *PrefixedRedisClient) Keys(pattern string) ([]string, error)

Keys wraps around redis keys method by adding prefix and returning []string and error directly

func (*PrefixedRedisClient) LLen

func (p *PrefixedRedisClient) LLen(key string) (int64, error)

LLen Returns the length of the list stored at key

func (*PrefixedRedisClient) LRange

func (p *PrefixedRedisClient) LRange(key string, start, stop int64) ([]string, error)

LRange Returns the specified elements of the list stored at key

func (*PrefixedRedisClient) LTrim

func (p *PrefixedRedisClient) LTrim(key string, start, stop int64) error

LTrim Trim an existing list so that it will contain only the specified range of elements specified

func (*PrefixedRedisClient) MGet

func (p *PrefixedRedisClient) MGet(keys []string) ([]interface{}, error)

MGet fetchs multiple results

func (*PrefixedRedisClient) RPush

func (p *PrefixedRedisClient) RPush(key string, values ...interface{}) (int64, error)

RPush insert all the specified values at the tail of the list stored at key

func (*PrefixedRedisClient) SAdd

func (p *PrefixedRedisClient) SAdd(key string, members ...interface{}) (int64, error)

SAdd adds new members to a set

func (*PrefixedRedisClient) SCard

func (p *PrefixedRedisClient) SCard(key string) (int64, error)

SCard implements SCard wrapper for redis

func (*PrefixedRedisClient) SIsMember

func (p *PrefixedRedisClient) SIsMember(key string, member interface{}) bool

SIsMember returns true if members is in the set

func (*PrefixedRedisClient) SMembers

func (p *PrefixedRedisClient) SMembers(key string) ([]string, error)

SMembers returns a slice with all the members of a set

func (*PrefixedRedisClient) SRem

func (p *PrefixedRedisClient) SRem(key string, members ...interface{}) (int64, error)

SRem removes members from a set

func (*PrefixedRedisClient) Set

func (p *PrefixedRedisClient) Set(key string, value interface{}, expiration time.Duration) error

Set wraps around redis get method by adding prefix and returning error directly

func (*PrefixedRedisClient) TTL

TTL for particular key

type Result

type Result interface {
	Int() int64
	String() string
	Bool() bool
	Duration() time.Duration
	Result() (int64, error)
	ResultString() (string, error)
	Multi() ([]string, error)
	MultiInterface() ([]interface{}, error)
	Err() error
	MapStringString() (map[string]string, error)
}

Result generic interface

type ResultImpl

type ResultImpl struct {
	// contains filtered or unexported fields
}

ResultImpl generic interface

func (*ResultImpl) Bool

func (r *ResultImpl) Bool() bool

Bool implementation

func (*ResultImpl) Duration

func (r *ResultImpl) Duration() time.Duration

Duration implementation

func (*ResultImpl) Err

func (r *ResultImpl) Err() error

Err implementation

func (*ResultImpl) Int

func (r *ResultImpl) Int() int64

Int implementation

func (*ResultImpl) MapStringString

func (r *ResultImpl) MapStringString() (map[string]string, error)

MapStringString implementation

func (*ResultImpl) Multi

func (r *ResultImpl) Multi() ([]string, error)

Multi implementation

func (*ResultImpl) MultiInterface

func (r *ResultImpl) MultiInterface() ([]interface{}, error)

MultiInterface implementation

func (*ResultImpl) Result

func (r *ResultImpl) Result() (int64, error)

Result implementation

func (*ResultImpl) ResultString

func (r *ResultImpl) ResultString() (string, error)

ResultString implementation

func (*ResultImpl) String

func (r *ResultImpl) String() string

String implementation

type UniversalOptions

type UniversalOptions = wredis.UniversalOptions

UniversalOptions type used for redis package

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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