redis

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNil = errors.New("redis returned nil")

Functions

This section is empty.

Types

type Cache

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

func New

func New(modelName string) *Cache

func (*Cache) Client

func (db *Cache) Client() Client

func (*Cache) Delete

func (db *Cache) Delete(key string) Result

func (*Cache) Exists

func (db *Cache) Exists(key string) Result

func (*Cache) Expire

func (db *Cache) Expire(key string, seconds interface{}) Result

func (*Cache) Get

func (db *Cache) Get(key string) Result

func (*Cache) HGet

func (db *Cache) HGet(key string, hkey string) Result

func (*Cache) Hset

func (db *Cache) Hset(key string, hkey string, value interface{}) Result

func (*Cache) Incr

func (db *Cache) Incr(key string) Result

func (*Cache) Pipe

func (db *Cache) Pipe(method func(c Conn) error) (result Result)

func (*Cache) Set

func (db *Cache) Set(key string, val interface{}) Result

func (*Cache) SetWithExpire

func (db *Cache) SetWithExpire(key string, val interface{}, seconds interface{}) Result

func (*Cache) Smembers

func (db *Cache) Smembers(key string) Result

type Client

type Client interface {
	GetConn() (conn redis.Conn)
	Close()
	Do(cmd string, args ...interface{}) Result
}

func Init

func Init(config Config) (Client, error)

func NewClient

func NewClient(config Config) (Client, error)

type Config

type Config struct {
	Addr     string
	Username string
	Password string
	// Maximum number of idle connections in the pool.
	MaxIdle int
	// Maximum number of connections allocated by the pool at a given time.
	// When zero, there is no limit on the number of connections in the pool.
	MaxActive int
	// Close connections after remaining idle for this duration. If the value
	// is zero, then idle connections are not closed. Applications should set
	// the timeout to a value less than the server's timeout.
	IdleTimeout time.Duration
	// If Wait is true and the pool is at the MaxActive limit, then Get() waits
	// for a connection to be returned to the pool before returning.
	Wait bool
	// Close connections older than this duration. If the value is zero, then
	// the pool does not close connections based on age.
	MaxConnLifetime time.Duration

	ClientName string
	Database   int
}

type Conn

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

func (Conn) Send

func (conn Conn) Send(command string, args ...interface{}) error

type Result

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

func (Result) Bool

func (result Result) Bool() (bool, error)

func (Result) ByteSlices

func (result Result) ByteSlices() ([][]byte, error)

func (Result) Bytes

func (result Result) Bytes() ([]byte, error)

func (Result) Error added in v0.1.5

func (result Result) Error() error

func (Result) Float64

func (result Result) Float64() (float64, error)

func (Result) Float64s

func (result Result) Float64s() ([]float64, error)

func (Result) Int

func (result Result) Int() (int, error)

func (Result) Int64

func (result Result) Int64() (int64, error)

func (Result) Int64Map

func (result Result) Int64Map() (map[string]int64, error)

func (Result) Int64s

func (result Result) Int64s() ([]int64, error)

func (Result) IntMap

func (result Result) IntMap() (map[string]int, error)

func (Result) Ints

func (result Result) Ints() ([]int, error)

func (Result) Positions

func (result Result) Positions() ([]*[2]float64, error)

func (Result) Reply added in v0.1.5

func (result Result) Reply() interface{}

func (Result) SlowLogs

func (result Result) SlowLogs() ([]redis.SlowLog, error)

func (Result) String

func (result Result) String() (string, error)

func (Result) StringMap

func (result Result) StringMap() (map[string]string, error)

func (Result) Strings

func (result Result) Strings() ([]string, error)

func (Result) Uint64

func (result Result) Uint64() (uint64, error)

func (Result) Uint64Map

func (result Result) Uint64Map() (map[string]uint64, error)

func (Result) Uint64s

func (result Result) Uint64s() ([]uint64, error)

func (Result) Value

func (result Result) Value() (interface{}, error)

func (Result) Values

func (result Result) Values() ([]interface{}, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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