0b1b121d by fuxiaohei

code style simplify

1 parent 8683ee7c
...@@ -135,11 +135,11 @@ func (fc *FileCache) Get(key string) interface{} { ...@@ -135,11 +135,11 @@ func (fc *FileCache) Get(key string) interface{} {
135 func (fc *FileCache) Put(key string, val interface{}, timeout int64) error { 135 func (fc *FileCache) Put(key string, val interface{}, timeout int64) error {
136 gob.Register(val) 136 gob.Register(val)
137 137
138 item := FileCacheItem{Data:val} 138 item := FileCacheItem{Data: val}
139 if timeout == FileCacheEmbedExpiry { 139 if timeout == FileCacheEmbedExpiry {
140 item.Expired = time.Now().Unix()+(86400*365*10) // ten years 140 item.Expired = time.Now().Unix() + (86400 * 365 * 10) // ten years
141 } else { 141 } else {
142 item.Expired = time.Now().Unix()+timeout 142 item.Expired = time.Now().Unix() + timeout
143 } 143 }
144 item.Lastaccess = time.Now().Unix() 144 item.Lastaccess = time.Now().Unix()
145 data, err := Gob_encode(item) 145 data, err := Gob_encode(item)
...@@ -166,7 +166,7 @@ func (fc *FileCache) Incr(key string) error { ...@@ -166,7 +166,7 @@ func (fc *FileCache) Incr(key string) error {
166 if reflect.TypeOf(data).Name() != "int" { 166 if reflect.TypeOf(data).Name() != "int" {
167 incr = 0 167 incr = 0
168 } else { 168 } else {
169 incr = data.(int)+1 169 incr = data.(int) + 1
170 } 170 }
171 fc.Put(key, incr, FileCacheEmbedExpiry) 171 fc.Put(key, incr, FileCacheEmbedExpiry)
172 return nil 172 return nil
...@@ -179,7 +179,7 @@ func (fc *FileCache) Decr(key string) error { ...@@ -179,7 +179,7 @@ func (fc *FileCache) Decr(key string) error {
179 if reflect.TypeOf(data).Name() != "int" || data.(int)-1 <= 0 { 179 if reflect.TypeOf(data).Name() != "int" || data.(int)-1 <= 0 {
180 decr = 0 180 decr = 0
181 } else { 181 } else {
182 decr = data.(int)-1 182 decr = data.(int) - 1
183 } 183 }
184 fc.Put(key, decr, FileCacheEmbedExpiry) 184 fc.Put(key, decr, FileCacheEmbedExpiry)
185 return nil 185 return nil
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!