1
0
mirror of https://github.com/astaxie/beego.git synced 2025-06-11 08:20:40 +00:00

for issue #1530, accept @JessonChan's suggestion

This commit is contained in:
youngsterxyf
2016-01-08 20:16:58 +08:00
parent bb43d3a78c
commit 0b0904db13
9 changed files with 11 additions and 11 deletions

View File

@ -100,7 +100,7 @@ func (rc *Cache) Put(key string, val interface{}, timeout time.Duration) error {
if !ok {
return errors.New("val must string")
}
item := memcache.Item{Key: key, Value: []byte(v), Expiration: int32(timeout.Seconds())}
item := memcache.Item{Key: key, Value: []byte(v), Expiration: int32(timeout/time.Second)}
return rc.conn.Set(&item)
}

View File

@ -28,7 +28,7 @@ func TestMemcacheCache(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)
}