diff --git a/memory.go b/memory.go index 0814251..0c842a9 100644 --- a/memory.go +++ b/memory.go @@ -3,6 +3,7 @@ package cache import ( "errors" "github.com/patrickmn/go-cache" + "github.com/vmihailenco/msgpack/v4" "reflect" "time" ) @@ -36,7 +37,14 @@ func (mc *MemoryCache) Get(key string, dst ...interface{}) ([]byte, error) { } if len(dst) == 0 { - return nil, ErrMemoryCacheNotSupported + switch item.(type) { + case string: + return []byte(item.(string)), nil + case []byte: + return item.([]byte), nil + } + + return msgpack.Marshal(item) } v := dst[0]