diff options
Diffstat (limited to 'plugins/kv/memcached/plugin.go')
-rw-r--r-- | plugins/kv/memcached/plugin.go | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/plugins/kv/memcached/plugin.go b/plugins/kv/memcached/plugin.go index 69f96bfe..f5111c04 100644 --- a/plugins/kv/memcached/plugin.go +++ b/plugins/kv/memcached/plugin.go @@ -1,7 +1,6 @@ package memcached import ( - "context" "strings" "time" @@ -58,8 +57,18 @@ func (s *Plugin) Stop() error { return nil } +// RPCService returns associated rpc service. +func (s *Plugin) RPC() interface{} { + return kv.NewRPCServer(s, s.log) +} + +// Name returns plugin user-friendly name +func (s *Plugin) Name() string { + return PluginName +} + // Has checks the key for existence -func (s Plugin) Has(ctx context.Context, keys ...string) (map[string]bool, error) { +func (s Plugin) Has(keys ...string) (map[string]bool, error) { const op = errors.Op("memcached Has") if keys == nil { return nil, errors.E(op, errors.NoKeys) @@ -84,7 +93,7 @@ func (s Plugin) Has(ctx context.Context, keys ...string) (map[string]bool, error // Get gets the item for the given key. ErrCacheMiss is returned for a // memcache cache miss. The key must be at most 250 bytes in length. -func (s Plugin) Get(ctx context.Context, key string) ([]byte, error) { +func (s Plugin) Get(key string) ([]byte, error) { const op = errors.Op("memcached Get") // to get cases like " " keyTrimmed := strings.TrimSpace(key) @@ -106,7 +115,7 @@ func (s Plugin) Get(ctx context.Context, key string) ([]byte, error) { // return map with key -- string // and map value as value -- []byte -func (s Plugin) MGet(ctx context.Context, keys ...string) (map[string]interface{}, error) { +func (s Plugin) MGet(keys ...string) (map[string]interface{}, error) { const op = errors.Op("memcached MGet") if keys == nil { return nil, errors.E(op, errors.NoKeys) @@ -141,7 +150,7 @@ func (s Plugin) MGet(ctx context.Context, keys ...string) (map[string]interface{ // Expiration is the cache expiration time, in seconds: either a relative // time from now (up to 1 month), or an absolute Unix epoch time. // Zero means the Item has no expiration time. -func (s Plugin) Set(ctx context.Context, items ...kv.Item) error { +func (s Plugin) Set(items ...kv.Item) error { const op = errors.Op("memcached Set") if items == nil { return errors.E(op, errors.NoKeys) @@ -182,7 +191,7 @@ func (s Plugin) Set(ctx context.Context, items ...kv.Item) error { // Expiration is the cache expiration time, in seconds: either a relative // time from now (up to 1 month), or an absolute Unix epoch time. // Zero means the Item has no expiration time. -func (s Plugin) MExpire(ctx context.Context, items ...kv.Item) error { +func (s Plugin) MExpire(items ...kv.Item) error { const op = errors.Op("memcached MExpire") for i := range items { if items[i].TTL == "" || strings.TrimSpace(items[i].Key) == "" { @@ -209,12 +218,12 @@ func (s Plugin) MExpire(ctx context.Context, items ...kv.Item) error { } // return time in seconds (int32) for a given keys -func (s Plugin) TTL(ctx context.Context, keys ...string) (map[string]interface{}, error) { +func (s Plugin) TTL(keys ...string) (map[string]interface{}, error) { const op = errors.Op("memcached HTTLas") return nil, errors.E(op, errors.Str("not valid request for memcached, see https://github.com/memcached/memcached/issues/239")) } -func (s Plugin) Delete(ctx context.Context, keys ...string) error { +func (s Plugin) Delete(keys ...string) error { const op = errors.Op("memcached Has") if keys == nil { return errors.E(op, errors.NoKeys) |