package redis
|
|
|
|
import (
|
|
redisdb "github.com/gomodule/redigo/redis"
|
|
)
|
|
|
|
/**
|
|
* 设置有效期
|
|
*/
|
|
func SetExpire(key string, expire int64) (int64, error) {
|
|
c := GetConn()
|
|
var err error
|
|
var reply interface{}
|
|
reply, err = c.Do("expire", key, expire)
|
|
|
|
CloseConn(c)
|
|
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
return redisdb.Int64(reply, err)
|
|
}
|