fix memory cache Put method should set value when key exist.
Showing
1 changed file
with
1 additions
and
5 deletions
| ... | @@ -53,11 +53,7 @@ func (bc *MemoryCache) Put(name string, value interface{}, expired int64) error | ... | @@ -53,11 +53,7 @@ func (bc *MemoryCache) Put(name string, value interface{}, expired int64) error |
| 53 | Lastaccess: time.Now(), | 53 | Lastaccess: time.Now(), |
| 54 | expired: expired, | 54 | expired: expired, |
| 55 | } | 55 | } |
| 56 | if _, ok := bc.items[name]; ok { | 56 | bc.items[name] = &t |
| 57 | return errors.New("the key is exist") | ||
| 58 | } else { | ||
| 59 | bc.items[name] = &t | ||
| 60 | } | ||
| 61 | return nil | 57 | return nil |
| 62 | } | 58 | } |
| 63 | 59 | ... | ... |
-
Please register or sign in to post a comment