1
This commit is contained in:
86
business/jxutils/cache/redis/redis.go
vendored
86
business/jxutils/cache/redis/redis.go
vendored
@@ -74,46 +74,46 @@ func (c *Cacher) Keys(prefix string) ([]string, error) {
|
|||||||
return c.client.Keys(prefix + "*").Result()
|
return c.client.Keys(prefix + "*").Result()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cacher) RPush(key string, value interface{}) error {
|
//func (c *Cacher) RPush(key string, value interface{}) error {
|
||||||
return c.client.RPush(key, value).Err()
|
// return c.client.RPush(key, value).Err()
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
func (c *Cacher) FlushDB() error {
|
//func (c *Cacher) FlushDB() error {
|
||||||
return c.client.FlushDB().Err()
|
// return c.client.FlushDB().Err()
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
func (c *Cacher) Expire(key string, expiration time.Duration) error {
|
//func (c *Cacher) Expire(key string, expiration time.Duration) error {
|
||||||
return c.client.Expire(key, expiration).Err()
|
// return c.client.Expire(key, expiration).Err()
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
func (c *Cacher) ExpireResult(key string, expiration time.Duration) (bool, error) {
|
//func (c *Cacher) ExpireResult(key string, expiration time.Duration) (bool, error) {
|
||||||
ok, err := c.client.Expire(key, expiration).Result()
|
// ok, err := c.client.Expire(key, expiration).Result()
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return false, err
|
// return false, err
|
||||||
}
|
// }
|
||||||
return ok, nil
|
// return ok, nil
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
func (c *Cacher) Exists(keys ...string) (int64, error) {
|
//func (c *Cacher) Exists(keys ...string) (int64, error) {
|
||||||
ret := c.client.Exists(keys...)
|
// ret := c.client.Exists(keys...)
|
||||||
return ret.Val(), ret.Err()
|
// return ret.Val(), ret.Err()
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
func (c *Cacher) Incr(key string) error {
|
//func (c *Cacher) Incr(key string) error {
|
||||||
return c.client.Incr(key).Err()
|
// return c.client.Incr(key).Err()
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
func (c *Cacher) LRange(key string) (retVal []string) {
|
//func (c *Cacher) LRange(key string) (retVal []string) {
|
||||||
if c.client.LLen(key).Val() > 0 {
|
// if c.client.LLen(key).Val() > 0 {
|
||||||
retVal = c.client.LRange(key, 0, -1).Val()
|
// retVal = c.client.LRange(key, 0, -1).Val()
|
||||||
}
|
// }
|
||||||
return retVal
|
// return retVal
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
func (c *Cacher) LSet(key string, index int, value interface{}) error {
|
//func (c *Cacher) LSet(key string, index int, value interface{}) error {
|
||||||
return c.client.LSet(key, int64(index), value).Err()
|
// return c.client.LSet(key, int64(index), value).Err()
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
func (c *Cacher) LRem(key string, count int, value interface{}) error {
|
//func (c *Cacher) LRem(key string, count int, value interface{}) error {
|
||||||
return c.client.LRem(key, int64(count), value).Err()
|
// return c.client.LRem(key, int64(count), value).Err()
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ import (
|
|||||||
"git.rosy.net.cn/baseapi/platformapi/yilianyunapi"
|
"git.rosy.net.cn/baseapi/platformapi/yilianyunapi"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/zhongwuapi"
|
"git.rosy.net.cn/baseapi/platformapi/zhongwuapi"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/cache"
|
"git.rosy.net.cn/jx-callback/business/jxutils/cache"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/cache/redis"
|
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
aliyunsmsclient "github.com/KenmyZhang/aliyun-communicate"
|
aliyunsmsclient "github.com/KenmyZhang/aliyun-communicate"
|
||||||
|
|
||||||
@@ -296,7 +295,7 @@ func Init() {
|
|||||||
|
|
||||||
//Cacher = redis.New(beego.AppConfig.DefaultString("redisHost", ""), beego.AppConfig.DefaultInt("redisPort", ""), beego.AppConfig.DefaultString("redisPassword", ""))
|
//Cacher = redis.New(beego.AppConfig.DefaultString("redisHost", ""), beego.AppConfig.DefaultInt("redisPort", ""), beego.AppConfig.DefaultString("redisPassword", ""))
|
||||||
//Todo 本地测试用
|
//Todo 本地测试用
|
||||||
Cacher = redis.New(beego.AppConfig.DefaultString("redisHost", "127.0.0.1"), beego.AppConfig.DefaultInt("redisPort", 6379), beego.AppConfig.DefaultString("redisPassword", "123456"))
|
//Cacher = redis.New(beego.AppConfig.DefaultString("redisHost", "127.0.0.1"), beego.AppConfig.DefaultInt("redisPort", 6379), beego.AppConfig.DefaultString("redisPassword", "123456"))
|
||||||
|
|
||||||
AliUpcAPI = aliupcapi.New(beego.AppConfig.DefaultString("aliUpcAppCode", ""))
|
AliUpcAPI = aliupcapi.New(beego.AppConfig.DefaultString("aliUpcAppCode", ""))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user