mirror of
https://github.com/astaxie/beego.git
synced 2025-06-11 08:50:39 +00:00
for issue #1530, accept @JessonChan's suggestion
This commit is contained in:
2
cache/redis/redis.go
vendored
2
cache/redis/redis.go
vendored
@ -111,7 +111,7 @@ ERROR:
|
||||
// Put put cache to redis.
|
||||
func (rc *Cache) Put(key string, val interface{}, timeout time.Duration) error {
|
||||
var err error
|
||||
if _, err = rc.do("SETEX", key, int64(timeout.Seconds()), val); err != nil {
|
||||
if _, err = rc.do("SETEX", key, int64(timeout/time.Second), val); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
2
cache/redis/redis_test.go
vendored
2
cache/redis/redis_test.go
vendored
@ -28,7 +28,7 @@ func TestRedisCache(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error("init err")
|
||||
}
|
||||
timeoutDuration := time.Second * 10
|
||||
timeoutDuration := 10 * time.Second
|
||||
if err = bm.Put("astaxie", 1, timeoutDuration); err != nil {
|
||||
t.Error("set Error", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user