Documentation
¶
Index ¶
- Constants
- Variables
- func AllCache(search string, page, rows int) (et.List, error)
- func Close()
- func Decr(key string) int64
- func DecrCtx(ctx context.Context, key string) int64
- func Delete(key string) (int64, error)
- func DeleteCtx(ctx context.Context, key string) (int64, error)
- func DeleteVerify(device string, key string) (int64, error)
- func Empty(match string) error
- func Exists(key string) bool
- func ExistsCtx(ctx context.Context, key string) bool
- func Expire(key string, second time.Duration) error
- func ExpireCtx(ctx context.Context, key string, second time.Duration) error
- func GenId(args ...interface{}) string
- func GenKey(args ...interface{}) string
- func Get(key, def string) (string, error)
- func GetBool(key string) (bool, error)
- func GetCtx(ctx context.Context, key, def string) (string, error)
- func GetFloat(key string) (float64, error)
- func GetInt(key string) (int, error)
- func GetInt64(key string) (int64, error)
- func GetItem(key string) (et.Item, error)
- func GetItems(key string) (et.Items, error)
- func GetJson(key string) (et.Json, error)
- func GetVerify(device string, key string) (string, error)
- func HDelete(key, atr string) error
- func HDeleteCtx(ctx context.Context, key, atr string) error
- func HGet(key string) (map[string]string, error)
- func HGetAtrib(key, atr string) (string, error)
- func HGetCtx(ctx context.Context, key string) (map[string]string, error)
- func HSet(key string, val map[string]string) error
- func HSetAtrib(key, atr, val string) error
- func HSetCtx(ctx context.Context, key string, val map[string]string) error
- func HandlerAll(w http.ResponseWriter, r *http.Request)
- func HandlerDelete(w http.ResponseWriter, r *http.Request)
- func HandlerGet(w http.ResponseWriter, r *http.Request)
- func HealthCheck() bool
- func Incr(key string, second time.Duration) int64
- func IncrCtx(ctx context.Context, key string, second time.Duration) int64
- func IsLoad() bool
- func LPush(key, val string) error
- func LPushCtx(ctx context.Context, key string, val string) error
- func LRange(key string, start, stop int64) ([]string, error)
- func LRangeCtx(ctx context.Context, key string, start int64, stop int64) ([]string, error)
- func LRem(key, val string) error
- func LRemCtx(ctx context.Context, key string, val string) error
- func LTrim(key string, start, stop int64) error
- func LTrimCtx(ctx context.Context, key string, start int64, stop int64) error
- func More(key string, second time.Duration) int
- func Set(key string, val interface{}, second time.Duration) error
- func SetCtx(ctx context.Context, key, val string, second time.Duration) error
- func SetD(key string, val interface{}) error
- func SetH(key string, val interface{}) error
- func SetM(key string, val interface{}) error
- func SetVerify(device, key, val string, duration time.Duration) error
- func SetW(key string, val interface{}) error
- func SetY(key string, val interface{}) error
- type Conn
- type Message
Constants ¶
const IsNil = redis.Nil
Variables ¶
var DecrKeepTTLScript = redis.NewScript(`
local val = redis.call("GET", KEYS[1])
if not val then
return -1
end
val = tonumber(val)
if val > 0 then
return redis.call("DECR", KEYS[1])
else
return -1
end
`)
var FromId string
var IncrSetTTLScript = redis.NewScript(`
local ttl = tonumber(ARGV[1])
local newVal = redis.call("INCR", KEYS[1])
if ttl > 0 then
redis.call("PEXPIRE", KEYS[1], ttl)
end
return newVal
`)
Functions ¶
func AllCache ¶
* * AllCache * @params device string * @params key string * @params val string * @return error *
func DecrCtx ¶ added in v1.1.91
* * DecrCtx * @params ctx context.Context, key string * @return int64 *
func DeleteVerify ¶
* * DeleteVerify * @params device string * @params key string * @return int64, error *
func ExistsCtx ¶ added in v1.1.38
* * ExistsCtx * @params ctx context.Context, key string * @return bool *
func Expire ¶ added in v1.1.124
* * Expire * @params key string, second time.Duration * @return error *
func ExpireCtx ¶ added in v1.1.124
* * ExpireCtx * @params ctx context.Context, key string, second time.Duration * @return error *
func GenId ¶ added in v1.1.21
func GenId(args ...interface{}) string
* * GenId * @params args ...interface{} * @return string *
func GenKey ¶ added in v1.1.0
func GenKey(args ...interface{}) string
* * GenKey * @params args ...interface{} * @return string *
func GetCtx ¶
* * GetCtx * @params ctx context.Context, key string * @params def string * @return string, error *
func GetVerify ¶
* * GetVerify * @params device string * @params key string * @return string, error *
func HDeleteCtx ¶
* * HDeleteCtx * @params ctx context.Context, key string * @params atr string * @return error *
func HGetCtx ¶
* * HGetCtx * @params ctx context.Context, key string * @return map[string]string, error *
func HSetAtrib ¶
* * HSetAtrib * @params key string * @params atr string * @params val string * @return error *
func HSetCtx ¶
* * HSetCtx * @params ctx context.Context, key string, val map[string]string * @return error *
func HandlerAll ¶
func HandlerAll(w http.ResponseWriter, r *http.Request)
* * HandlerAll * @params w http.ResponseWriter * @params r *http.Request *
func HandlerDelete ¶
func HandlerDelete(w http.ResponseWriter, r *http.Request)
* * HandlerDelete * @params w http.ResponseWriter * @params r *http.Request *
func HandlerGet ¶
func HandlerGet(w http.ResponseWriter, r *http.Request)
* * HandlerGet * @params w http.ResponseWriter * @params r *http.Request *
func Incr ¶ added in v1.1.91
* * Incr * @params key string, second time.Duration (second) * @return int64 *
func IncrCtx ¶ added in v1.1.91
* * IncrCtx * @params ctx context.Context, key string, second time.Duration * @return int64 *
func LPushCtx ¶ added in v1.1.115
* * LPushCtx * @params ctx context.Context, key string, val string * @return error *
func LRange ¶ added in v1.1.115
* * LRange * @params key string, start int64, stop int64 * @return []string, error *
func LRangeCtx ¶ added in v1.1.115
* * LRangeCtx * @params ctx context.Context, key string, start int64, stop int64 * @return []string, error *
func LRemCtx ¶ added in v1.1.115
* * LPushCtx * @params ctx context.Context, key string, val string * @return error *
func LTrim ¶ added in v1.1.115
* * LTrim * @params key string, start int64, stop int64 * @return error *
func LTrimCtx ¶ added in v1.1.115
* * LTrimCtx * @params ctx context.Context, key string, start int64, stop int64 * @return error *
func SetCtx ¶
* * SetCtx * @params ctx context.Context, key string, val string, second time.Duration * @return error *
func SetVerify ¶
* * SetVerify * @params device string * @params key string * @params val string * @params duration time.Duration * @return error *
Types ¶
type Conn ¶
func ConnectTo ¶ added in v1.1.30
* * ConnectTo * @param host, password string, dbname int * @return *Conn, error *
func (*Conn) Pub ¶ added in v1.1.30
* * Pub * @param channel string * @param message interface{} * @return error *