1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-30 23:44:12 +00:00

tiny fix for error description and comment

This commit is contained in:
JessonChan 2016-01-06 15:12:25 +08:00
parent 0b39091292
commit 8832334d6a

8
cache/memory.go vendored
View File

@ -106,7 +106,7 @@ func (bc *MemoryCache) Delete(name string) error {
} }
// Incr increase cache counter in memory. // Incr increase cache counter in memory.
// it supports int,int64,int32,uint,uint64,uint32. // it supports int,int32,int64,uint,uint32,uint64.
func (bc *MemoryCache) Incr(key string) error { func (bc *MemoryCache) Incr(key string) error {
bc.lock.RLock() bc.lock.RLock()
defer bc.lock.RUnlock() defer bc.lock.RUnlock()
@ -117,10 +117,10 @@ func (bc *MemoryCache) Incr(key string) error {
switch itm.val.(type) { switch itm.val.(type) {
case int: case int:
itm.val = itm.val.(int) + 1 itm.val = itm.val.(int) + 1
case int64:
itm.val = itm.val.(int64) + 1
case int32: case int32:
itm.val = itm.val.(int32) + 1 itm.val = itm.val.(int32) + 1
case int64:
itm.val = itm.val.(int64) + 1
case uint: case uint:
itm.val = itm.val.(uint) + 1 itm.val = itm.val.(uint) + 1
case uint32: case uint32:
@ -128,7 +128,7 @@ func (bc *MemoryCache) Incr(key string) error {
case uint64: case uint64:
itm.val = itm.val.(uint64) + 1 itm.val = itm.val.(uint64) + 1
default: default:
return errors.New("item val is not int int64 int32") return errors.New("item val is not (u)int (u)int32 (u)int64")
} }
return nil return nil
} }