Get return cached value
(key string)
| 20 | |
| 21 | // Get return cached value |
| 22 | func (mem *Memcache) Get(key string) interface{} { |
| 23 | var err error |
| 24 | var item *memcache.Item |
| 25 | if item, err = mem.conn.Get(key); err != nil { |
| 26 | return nil |
| 27 | } |
| 28 | var result interface{} |
| 29 | if err = json.Unmarshal(item.Value, &result); err != nil { |
| 30 | return nil |
| 31 | } |
| 32 | return result |
| 33 | } |
| 34 | |
| 35 | // IsExist check value exists in memcache. |
| 36 | func (mem *Memcache) IsExist(key string) bool { |