fixup slice override
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
f9cdd41c94
commit
e2420ba9c1
24
redis.go
24
redis.go
@ -218,9 +218,11 @@ func (r *Store) MRead(ctx context.Context, keys []string, vals interface{}, opts
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var rkeys []string
|
||||||
if r.opts.Namespace != "" || options.Namespace != "" {
|
if r.opts.Namespace != "" || options.Namespace != "" {
|
||||||
|
rkeys = make([]string, len(keys))
|
||||||
for idx, key := range keys {
|
for idx, key := range keys {
|
||||||
keys[idx] = r.getKey(r.opts.Namespace, options.Namespace, key)
|
rkeys[idx] = r.getKey(r.opts.Namespace, options.Namespace, key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,11 +230,19 @@ func (r *Store) MRead(ctx context.Context, keys []string, vals interface{}, opts
|
|||||||
ts := time.Now()
|
ts := time.Now()
|
||||||
var rvals []interface{}
|
var rvals []interface{}
|
||||||
var err error
|
var err error
|
||||||
|
if r.opts.Namespace != "" || options.Namespace != "" {
|
||||||
|
if r.cli.Client != nil {
|
||||||
|
rvals, err = r.cli.Client.MGet(ctx, rkeys...).Result()
|
||||||
|
} else {
|
||||||
|
rvals, err = r.cli.ClusterClient.MGet(ctx, rkeys...).Result()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if r.cli.Client != nil {
|
if r.cli.Client != nil {
|
||||||
rvals, err = r.cli.Client.MGet(ctx, keys...).Result()
|
rvals, err = r.cli.Client.MGet(ctx, keys...).Result()
|
||||||
} else {
|
} else {
|
||||||
rvals, err = r.cli.ClusterClient.MGet(ctx, keys...).Result()
|
rvals, err = r.cli.ClusterClient.MGet(ctx, keys...).Result()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
setSpanError(ctx, err)
|
setSpanError(ctx, err)
|
||||||
te := time.Since(ts)
|
te := time.Since(ts)
|
||||||
r.opts.Meter.Counter(semconv.StoreRequestInflight, "name", options.Name).Dec()
|
r.opts.Meter.Counter(semconv.StoreRequestInflight, "name", options.Name).Dec()
|
||||||
@ -308,20 +318,30 @@ func (r *Store) MDelete(ctx context.Context, keys []string, opts ...store.Delete
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var rkeys []string
|
||||||
if r.opts.Namespace != "" || options.Namespace != "" {
|
if r.opts.Namespace != "" || options.Namespace != "" {
|
||||||
|
rkeys = make([]string, len(keys))
|
||||||
for idx, key := range keys {
|
for idx, key := range keys {
|
||||||
keys[idx] = r.getKey(r.opts.Namespace, options.Namespace, key)
|
rkeys[idx] = r.getKey(r.opts.Namespace, options.Namespace, key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r.opts.Meter.Counter(semconv.StoreRequestInflight, "name", options.Name).Inc()
|
r.opts.Meter.Counter(semconv.StoreRequestInflight, "name", options.Name).Inc()
|
||||||
ts := time.Now()
|
ts := time.Now()
|
||||||
var err error
|
var err error
|
||||||
|
if r.opts.Namespace != "" || options.Namespace != "" {
|
||||||
|
if r.cli.Client != nil {
|
||||||
|
err = r.cli.Client.Del(ctx, rkeys...).Err()
|
||||||
|
} else {
|
||||||
|
err = r.cli.ClusterClient.Del(ctx, rkeys...).Err()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if r.cli.Client != nil {
|
if r.cli.Client != nil {
|
||||||
err = r.cli.Client.Del(ctx, keys...).Err()
|
err = r.cli.Client.Del(ctx, keys...).Err()
|
||||||
} else {
|
} else {
|
||||||
err = r.cli.ClusterClient.Del(ctx, keys...).Err()
|
err = r.cli.ClusterClient.Del(ctx, keys...).Err()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
setSpanError(ctx, err)
|
setSpanError(ctx, err)
|
||||||
te := time.Since(ts)
|
te := time.Since(ts)
|
||||||
r.opts.Meter.Counter(semconv.StoreRequestInflight, "name", options.Name).Dec()
|
r.opts.Meter.Counter(semconv.StoreRequestInflight, "name", options.Name).Dec()
|
||||||
|
Loading…
Reference in New Issue
Block a user