myredis

package module
v0.0.0-...-55ffd59 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: MIT Imports: 4 Imported by: 0

README

myredis

my wrapper for redis to for rapid prototyping

Documentation

Index

Constants

View Source
const (
	// redis
	REDIS_MAX_IDLE_CONN = 10
	REDIS_PORT          = "6379"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	redis.Conn
	Log *logs.Logger
}

func (*Context) Close

func (self *Context) Close()

func (*Context) Delete

func (ctx *Context) Delete(keys ...interface{}) error

Delete uses the DEL command to remove any keys featuring in the supplied slice.

func (*Context) DeleteOrFail

func (ctx *Context) DeleteOrFail(keys ...interface{}) bool

Delete uses the DEL command to remove any keys featuring in the supplied slice.

func (*Context) Exists

func (ctx *Context) Exists(key string) (bool, error)

Exists returns whether the specified key exists

func (*Context) GetBool

func (ctx *Context) GetBool(key string) (bool, bool)

GetBool returns a key's value as boolean

func (*Context) GetBytes

func (ctx *Context) GetBytes(key string) (bool, []byte)

GetBytes returns a key's value as byte slice

func (*Context) GetFloat64

func (ctx *Context) GetFloat64(key string) (bool, float64)

GetFloat64 returns a key's value as float64

func (*Context) GetInt64

func (ctx *Context) GetInt64(key string) (bool, int64)

GetInt64 returns a key's value as int64

func (*Context) GetKeysFloat64

func (ctx *Context) GetKeysFloat64(regex string) map[string]float64

GetKeysFloat64 returns keys matching regex

func (*Context) GetKeysInt64

func (ctx *Context) GetKeysInt64(regex string) map[string]int64

GetKeysInt64 returns keys matching regex

func (*Context) GetKeysString

func (ctx *Context) GetKeysString(regex string) map[string]string

GetKeysString returns keys matching regex

func (*Context) GetString

func (ctx *Context) GetString(key string) (bool, string)

GetString returns a key's value as string

func (*Context) HDel

func (ctx *Context) HDel(hash, key string) bool

HDel removes a key from the map

func (*Context) HGetAll

func (ctx *Context) HGetAll(hash string) (map[string]string, error)

HGetAll retrieves all values from the map

func (*Context) HGetBool

func (ctx *Context) HGetBool(m, key string) (bool, bool)

HGetString retrieves the map's key's value as a bool

func (*Context) HGetString

func (ctx *Context) HGetString(m, key string) (bool, string)

HGetString retrieves the map's key's value as a string

func (*Context) HIncrby

func (ctx *Context) HIncrby(hashtable, key string, n int) error

Incrby increments the map's key's value with an integer

func (*Context) HIncrbyfloat

func (ctx *Context) HIncrbyfloat(hashtable, key string, n float64) error

Incrby increments the map's key's value with an float

func (*Context) HKeys

func (ctx *Context) HKeys(hash string) (bool, []string)

HKeys retrieves a slice of keys from the map

func (*Context) HSet

func (ctx *Context) HSet(obj, key string, value interface{}) error

HSet uses the HSET command to store an interface{} against the supplied key, in the supplied map.

func (*Context) Incrby

func (ctx *Context) Incrby(key string, n int) error

Incrby increments the key's value with an integer

func (*Context) Incrbyfloat

func (ctx *Context) Incrbyfloat(key string, n float64) error

Incrbyfloat increments the key's value by a float value

func (*Context) Set

func (ctx *Context) Set(key string, value interface{}) error

Set uses the SET command to store an interface{} against the supplied key.

func (*Context) SetAndExpire

func (ctx *Context) SetAndExpire(key string, value interface{}, expireSeconds int) error

SetAndExpire uses the SET command to store an interface{} against the supplied key. Once the key is set, the expire time is modified using the EXPIRE command.

type RedisClient

type RedisClient struct {
	*redis.Pool
	Log *logs.Logger
}

func NewClient

func NewClient(redisHost, redisPassword string) *RedisClient

func (*RedisClient) NewConn

func (self *RedisClient) NewConn() *Context

Jump to

Keyboard shortcuts

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