From 0b1b121db8818678d41d97d15269f3819a54650b Mon Sep 17 00:00:00 2001 From: fuxiaohei Date: Thu, 10 Jul 2014 13:38:05 +0800 Subject: [PATCH] code style simplify --- cache/file.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cache/file.go b/cache/file.go index dec68f87..b4af2211 100644 --- a/cache/file.go +++ b/cache/file.go @@ -135,11 +135,11 @@ func (fc *FileCache) Get(key string) interface{} { func (fc *FileCache) Put(key string, val interface{}, timeout int64) error { gob.Register(val) - item := FileCacheItem{Data:val} + item := FileCacheItem{Data: val} if timeout == FileCacheEmbedExpiry { - item.Expired = time.Now().Unix()+(86400*365*10) // ten years + item.Expired = time.Now().Unix() + (86400 * 365 * 10) // ten years } else { - item.Expired = time.Now().Unix()+timeout + item.Expired = time.Now().Unix() + timeout } item.Lastaccess = time.Now().Unix() data, err := Gob_encode(item) @@ -166,7 +166,7 @@ func (fc *FileCache) Incr(key string) error { if reflect.TypeOf(data).Name() != "int" { incr = 0 } else { - incr = data.(int)+1 + incr = data.(int) + 1 } fc.Put(key, incr, FileCacheEmbedExpiry) return nil @@ -179,7 +179,7 @@ func (fc *FileCache) Decr(key string) error { if reflect.TypeOf(data).Name() != "int" || data.(int)-1 <= 0 { decr = 0 } else { - decr = data.(int)-1 + decr = data.(int) - 1 } fc.Put(key, decr, FileCacheEmbedExpiry) return nil