summaryrefslogtreecommitdiff
path: root/plugins/kv/drivers/memory/driver.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-06-09 20:26:18 +0300
committerGitHub <[email protected]>2021-06-09 20:26:18 +0300
commitb99bfbe21a0f44b1a16b9110d779719fc637127c (patch)
tree3aabdb96c86a59325d816ad64cabc967ef2c8f10 /plugins/kv/drivers/memory/driver.go
parent8fdf05d4f360a9f6344141b273eab9d6859470e0 (diff)
parent7665167623147403d575b7e2cf125073cbe6584d (diff)
#715 feat(protocol): use protobuf for the `kv` and `websockets` RPC callsv2.3.0-beta.3
#715 feat(protocol): use protobuf for the `kv` and `websockets` RPC calls
Diffstat (limited to 'plugins/kv/drivers/memory/driver.go')
-rw-r--r--plugins/kv/drivers/memory/driver.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/plugins/kv/drivers/memory/driver.go b/plugins/kv/drivers/memory/driver.go
index 3158adee..9b7d7259 100644
--- a/plugins/kv/drivers/memory/driver.go
+++ b/plugins/kv/drivers/memory/driver.go
@@ -10,7 +10,6 @@ import (
"github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/plugins/kv"
"github.com/spiral/roadrunner/v2/plugins/logger"
- "github.com/spiral/roadrunner/v2/utils"
)
type Driver struct {
@@ -72,12 +71,12 @@ func (s *Driver) Get(key string) ([]byte, error) {
if data, exist := s.heap.Load(key); exist {
// here might be a panic
// but data only could be a string, see Set function
- return utils.AsBytes(data.(*kvv1.Item).Value), nil
+ return data.(*kvv1.Item).Value, nil
}
return nil, nil
}
-func (s *Driver) MGet(keys ...string) (map[string]interface{}, error) {
+func (s *Driver) MGet(keys ...string) (map[string][]byte, error) {
const op = errors.Op("in_memory_plugin_mget")
if keys == nil {
return nil, errors.E(op, errors.NoKeys)
@@ -91,7 +90,7 @@ func (s *Driver) MGet(keys ...string) (map[string]interface{}, error) {
}
}
- m := make(map[string]interface{}, len(keys))
+ m := make(map[string][]byte, len(keys))
for i := range keys {
if value, ok := s.heap.Load(keys[i]); ok {
@@ -160,7 +159,7 @@ func (s *Driver) MExpire(items ...*kvv1.Item) error {
return nil
}
-func (s *Driver) TTL(keys ...string) (map[string]interface{}, error) {
+func (s *Driver) TTL(keys ...string) (map[string]string, error) {
const op = errors.Op("in_memory_plugin_ttl")
if keys == nil {
return nil, errors.E(op, errors.NoKeys)
@@ -174,7 +173,7 @@ func (s *Driver) TTL(keys ...string) (map[string]interface{}, error) {
}
}
- m := make(map[string]interface{}, len(keys))
+ m := make(map[string]string, len(keys))
for i := range keys {
if item, ok := s.heap.Load(keys[i]); ok {