redis操作
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
340 B

  1. package redis
  2. import (
  3. redisdb "github.com/gomodule/redigo/redis"
  4. )
  5. /**
  6. * 设置有效期
  7. */
  8. func SetExpire(key string, expire int64) (int64, error) {
  9. c := GetConn()
  10. var err error
  11. var reply interface{}
  12. reply, err = c.Do("expire", key, expire)
  13. CloseConn(c)
  14. if err != nil {
  15. return 0, err
  16. }
  17. return redisdb.Int64(reply, err)
  18. }