NewMemoryCache create a memory cache
(keyPrefix string, encode encoding.Encoding, newObject func() interface{})
| 120 | |
| 121 | // NewMemoryCache create a memory cache |
| 122 | func NewMemoryCache(keyPrefix string, encode encoding.Encoding, newObject func() interface{}) Cache { |
| 123 | return &memoryCache{ |
| 124 | client: GetGlobalMemoryCli(), |
| 125 | KeyPrefix: keyPrefix, |
| 126 | encoding: encode, |
| 127 | newObject: newObject, |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | // Set data |
| 132 | func (m *memoryCache) Set(_ context.Context, key string, val interface{}, expiration time.Duration) error { |