Documentation
¶
Index ¶
- type Wredis
- func (w *Wredis) Close() error
- func (w *Wredis) Del(keys ...string) (int64, error)
- func (w *Wredis) DelWithPattern(pattern string) (int64, error)
- func (w *Wredis) ExecBool(f func(redis.Conn) (bool, error)) (bool, error)
- func (w *Wredis) ExecInt64(f func(redis.Conn) (int64, error)) (int64, error)
- func (w *Wredis) ExecString(f func(redis.Conn) (string, error)) (string, error)
- func (w *Wredis) ExecStrings(f func(redis.Conn) ([]string, error)) ([]string, error)
- func (w *Wredis) Exists(key string) (bool, error)
- func (w *Wredis) Expire(key string, seconds int) (bool, error)
- func (w *Wredis) FlushAll() error
- func (w *Wredis) FlushDb() error
- func (w *Wredis) Get(key string) (string, error)
- func (w *Wredis) Incr(key string) (int64, error)
- func (w *Wredis) Keys(pattern string) ([]string, error)
- func (w *Wredis) LLen(key string) (int64, error)
- func (w *Wredis) LPush(key string, items ...string) (int64, error)
- func (w *Wredis) MGet(keys []string) ([]string, error)
- func (w *Wredis) RPop(key string) (string, error)
- func (w *Wredis) Rename(key, newKey string) error
- func (w *Wredis) SAdd(dest string, members []string) (int64, error)
- func (w *Wredis) SCard(key string) (int64, error)
- func (w *Wredis) SDiffStore(dest string, sets ...string) (int64, error)
- func (w *Wredis) SMembers(key string) ([]string, error)
- func (w *Wredis) SUnionStore(dest string, sets ...string) (int64, error)
- func (w *Wredis) Select(db uint) error
- func (w *Wredis) SelectAndFlushDb(db uint) error
- func (w *Wredis) Set(key, value string) error
- func (w *Wredis) SetEx(key, value string, seconds int) error
- func (w *Wredis) SetExDuration(key, value string, dur time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Wredis ¶
type Wredis struct {
// contains filtered or unexported fields
}
Wredis is a struct wrapper around the redis.Pool that implements Redis commands (http://redis.io/commands)
func NewDefaultPool ¶
NewDefaultPool returns a redis.Pool with a localhost:6379 address and db set to 0.
func NewPool ¶
NewPool creates a redis pool connected to the given host:port and db.
func NewUnsafe ¶
NewUnsafe returns an unsafe wrapper around the redigo Pool. The lack of safety allows usage of certain methods that could be harmful if accidentally invoked in production (e.g. FlushAll)
func (*Wredis) Del ¶
Del deletes one or more keys from Redis and returns a count of how many keys were actually deleted. See http://redis.io/commands/del
func (*Wredis) DelWithPattern ¶
DelWithPattern is a convenience method that Deletes all keys matching the pattern
func (*Wredis) ExecBool ¶
ExecBool is a helper function to execute any series of commands on a redis.Conn that returns a bool response
func (*Wredis) ExecInt64 ¶
ExecInt64 is a helper function to execute any series of commands on a redis.Conn that return an int64 response
func (*Wredis) ExecString ¶
ExecString is a helper function to execute any series of commands on a redis.Conn that return a string response
func (*Wredis) ExecStrings ¶
ExecStrings is a helper function to execute any series of commands on a redis.Conn that return a string slice response
func (*Wredis) Exists ¶
Exists checks for the existence of `key` in Redis. Note however, even though a variable number of keys can be passed to the EXISTS command since Redis 3.0.3, we will restrict this to a single key in order to be able to return an absolute response regarding existence. See http://redis.io/commands/exists
func (*Wredis) Expire ¶
Expire sets a timeout of "seconds" on "key". If an error is encountered, it is returned. If the key doesn't exist or the timeout couldn't be set, `false, nil` is returned. On success, `true, nil` is returned. See http://redis.io/commands/expire
func (*Wredis) FlushAll ¶
FlushAll deletes all the keys from all the db's on the Redis server. This is a very dangerous method to use in production. See http://redis.io/commands/flushall
func (*Wredis) FlushDb ¶
FlushDb deletes all the keys from the currently selected database See http://redis.io/commands/flushdb
func (*Wredis) Get ¶
Get fetches a key's string value. See http://redis.io/commands/get
func (*Wredis) Incr ¶
Incr increments the number stored at key by one. See http://redis.io/commands/incr
func (*Wredis) Keys ¶
Keys takes a pattern and returns any/all keys matching the pattern. See http://redis.io/commands/keys
func (*Wredis) LLen ¶
LLen returns the length of the list stored at key. For more information, see http://redis.io/commands/llen.
func (*Wredis) LPush ¶
LPush inserts the provided item(s) at the head of the list stored at key. For more information, see http://redis.io/commands/lpush.
func (*Wredis) MGet ¶
MGet returns the values of all provided keys. For a key that does not exist, an empty string is returned. See http://redis.io/commands/mget.
func (*Wredis) RPop ¶
RPop removes and returns the last element of the list stored at key. For more information, see http://redis.io/commands/rpop.
func (*Wredis) Rename ¶
Rename will rename `key` to `newKey`. They must not be empty or identical. See `http://redis.io/commands/rename`
func (*Wredis) SAdd ¶
SAdd implements the SADD command. It adds the `members` into the set `dest`. An error is returned if `members` is nil or empty, otherwise it returns the number of members added. See http://redis.io/commands/sadd
func (*Wredis) SCard ¶
SCard returns the cardinality of the set `key`. See http://redis.io/commands/scard
func (*Wredis) SDiffStore ¶
SDiffStore executes the SDIFFSTORE command. See `http://redis.io/commands/sdiffstore`
func (*Wredis) SMembers ¶
SMembers returns the members of the set denoted by `key`. See http://redis.io/commands/smembers
func (*Wredis) SUnionStore ¶
SUnionStore implements the SUNIONSTORE command. See `http://redis.io/commands/sunionstore`
func (*Wredis) Select ¶
Select selects the Database specified by the parameter. We use an unsigned int because Redis databases are numbered using a zero based index. See http://redis.io/commands
func (*Wredis) SelectAndFlushDb ¶
SelectAndFlushDb is a convenience method for flushing a specified DB
func (*Wredis) Set ¶
Set sets a key's string value. See http://redis.io/commands/set
func (*Wredis) SetEx ¶
SetEx sets key's to value with an expiry time measured in seconds. See http://redis.io/commands/setex