|
|
@ -20,3 +20,20 @@ func SetExpire(key string, expire int64) (int64, error) { |
|
|
|
} |
|
|
|
return redisdb.Int64(reply, err) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取有效期 |
|
|
|
*/ |
|
|
|
func GetExpire(key string) (int64, error) { |
|
|
|
c := GetConn() |
|
|
|
var err error |
|
|
|
var reply interface{} |
|
|
|
reply, err = c.Do("TTL", key) |
|
|
|
|
|
|
|
CloseConn(c) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return redisdb.Int64(reply, err) |
|
|
|
} |