Documentation ¶
Index ¶
- type RdPool
- func (c *RdPool) ClosePool() error
- func (c *RdPool) Del(key string) (int64, error)
- func (c *RdPool) Do(commandName string, args ...interface{}) (interface{}, error)
- func (c *RdPool) Expired(key string, seconds int) (int64, error)
- func (c *RdPool) Get(key string) (string, error)
- func (c *RdPool) HDel(key string, fields ...string) (int64, error)
- func (c *RdPool) HGet(key string, subKey string) (string, error)
- func (c *RdPool) HGetAll(key string) (map[string]string, error)
- func (c *RdPool) HMGet(key string, values ...string) ([]string, error)
- func (c *RdPool) HMSet(key string, kv map[string]string) (string, error)
- func (c *RdPool) HSet(key string, subKey string, val string) (int64, error)
- func (c *RdPool) HSetEX(key, field string, value interface{}, expire int) (int64, error)
- func (c *RdPool) Increment(key string) (int64, error)
- func (c *RdPool) LIndex(key string, index int) (string, error)
- func (c *RdPool) LLen(key string) (int64, error)
- func (c *RdPool) LPop(key string) (string, error)
- func (c *RdPool) LPush(key string, values ...interface{}) (int64, error)
- func (c *RdPool) LPushX(key string, values ...interface{}) (int64, error)
- func (c *RdPool) LRange(key string, start, stop int64) ([]string, error)
- func (c *RdPool) LRem(key string, count int, value string) (int64, error)
- func (c *RdPool) LSet(key, value string, index int) (int64, error)
- func (c *RdPool) LTrim(key string, start, stop int) (string, error)
- func (c *RdPool) MGet(keys ...string) ([]string, error)
- func (c *RdPool) MSet(pairs ...interface{}) (string, error)
- func (c *RdPool) Ping() (string, error)
- func (c *RdPool) Set(key string, val string) (string, error)
- func (c *RdPool) SetEX(key string, value interface{}, expire int) (string, error)
- func (c *RdPool) SetNX(key string, value interface{}, expire int) (int64, error)
- func (c *RdPool) SilenceGet(key string) string
- func (c *RdPool) Ttl(key string) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RdPool ¶
type RdPool struct { Name string // contains filtered or unexported fields }
func GetRedisPool ¶
GetRedisPool 每次用前先获得redis pool的实例
func (*RdPool) Del ¶
Del redis> SET key1 "Hello" "OK" redis> SET key2 "World" "OK" redis> DEL key1 key2 key3 (integer) 2
func (*RdPool) Expired ¶
Expired redis> SET mykey "Hello" "OK" redis> EXPIRE mykey 10 (integer) 1 redis> TTL mykey (integer) 10
func (*RdPool) HDel ¶
HDel redis> HSET myhash field1 "foo" (integer) 1 redis> HDEL myhash field1 (integer) 1
func (*RdPool) HGetAll ¶
HGetAll redis> HSET myhash field1 "Hello" (integer) 1 redis> HSET myhash field2 "World" (integer) 1 redis> HGETALL myhash 1) "field1" 2) "Hello" 3) "field2" 4) "World"
func (*RdPool) HMGet ¶
HMGet redis> HSET myhash field1 "Hello" (integer) 1 redis> HSET myhash field2 "World" (integer) 1 redis> HMGET myhash field1 field2 nofield 1) "Hello" 2) "World" 3) (nil)
func (*RdPool) HMSet ¶
HMSet redis> HMSET myhash field1 "Hello" field2 "World" "OK" redis> HGET myhash field1 "Hello" redis> HGET myhash field2 "World"
func (*RdPool) HSetEX ¶
HSetEX 127.0.0.1:6379> hset chair aaa 111 (integer) 1 127.0.0.1:6379> expire chair 10 (integer) 1 127.0.0.1:6379> ttl chair (integer) 8
func (*RdPool) Increment ¶
Increment redis> SET mykey "10" "OK" redis> INCR mykey (integer) 11 redis> GET mykey "11"
func (*RdPool) LIndex ¶
LIndex redis> LPUSH mylist "World" (integer) 1 redis> LPUSH mylist "Hello" (integer) 2 redis> LINDEX mylist 0 "Hello" redis> LINDEX mylist -1 "World" redis> LINDEX mylist 3 (nil)
func (*RdPool) LLen ¶
LLen redis> LPUSH mylist "World" (integer) 1 redis> LPUSH mylist "Hello" (integer) 2 redis> LLEN mylist (integer) 2 redis>
func (*RdPool) LPop ¶
LPop redis> RPUSH mylist "one" "two" "three" "four" "five" (integer) 5 redis> LPOP mylist "one" redis> LPOP mylist 2 1) "two" 2) "three" redis> LRANGE mylist 0 -1 1) "four" 2) "five"
func (*RdPool) LPush ¶
LPush redis> LPUSH mylist "world" (integer) 1 redis> LPUSH mylist "hello" (integer) 2 redis> LRANGE mylist 0 -1 1) "hello" 2) "world"
func (*RdPool) LPushX ¶
LPushX redis> LPUSH mylist "World" (integer) 1 redis> LPUSHX mylist "Hello" (integer) 2 redis> LPUSHX myotherlist "Hello" (integer) 0 redis> LRANGE mylist 0 -1 1) "Hello" 2) "World" redis> LRANGE myotherlist 0 -1 (empty array)
func (*RdPool) LRem ¶
LRem redis> RPUSH mylist "hello" (integer) 1 redis> RPUSH mylist "hello" (integer) 2 redis> RPUSH mylist "foo" (integer) 3 redis> RPUSH mylist "hello" (integer) 4 redis> LREM mylist -2 "hello" (integer) 2 redis> LRANGE mylist 0 -1 1) "hello" 2) "foo"
func (*RdPool) LSet ¶
LSet redis> RPUSH mylist "one" (integer) 1 redis> RPUSH mylist "two" (integer) 2 redis> RPUSH mylist "three" (integer) 3 redis> LSET mylist 0 "four" "OK" redis> LSET mylist -2 "five" "OK" redis> LRANGE mylist 0 -1 1) "four" 2) "five" 3) "three"
func (*RdPool) LTrim ¶
LTrim redis> RPUSH mylist "one" (integer) 1 redis> RPUSH mylist "two" (integer) 2 redis> RPUSH mylist "three" (integer) 3 redis> LTRIM mylist 1 -1 "OK" redis> LRANGE mylist 0 -1 1) "two" 2) "three"
func (*RdPool) SetEX ¶
SetEx redis> SETEX mykey 10 "Hello" "OK" redis> TTL mykey (integer) 10 redis> GET mykey "Hello" redis>