diff --git a/commands_test.go b/commands_test.go index fbeff1c2..81eb2eb6 100644 --- a/commands_test.go +++ b/commands_test.go @@ -686,6 +686,11 @@ var _ = Describe("Commands", func() { Expect(refCount.Err()).NotTo(HaveOccurred()) Expect(refCount.Val()).To(Equal(int64(1))) + client.ConfigSet(ctx, "maxmemory-policy", "volatile-lfu") + freq := client.ObjectFreq(ctx, "key") + Expect(freq.Err()).NotTo(HaveOccurred()) + client.ConfigSet(ctx, "maxmemory-policy", "noeviction") // default + err := client.ObjectEncoding(ctx, "key").Err() Expect(err).NotTo(HaveOccurred()) diff --git a/generic_commands.go b/generic_commands.go index bf1fb47d..dc6c3fe0 100644 --- a/generic_commands.go +++ b/generic_commands.go @@ -19,6 +19,7 @@ type GenericCmdable interface { Keys(ctx context.Context, pattern string) *StringSliceCmd Migrate(ctx context.Context, host, port, key string, db int, timeout time.Duration) *StatusCmd Move(ctx context.Context, key string, db int) *BoolCmd + ObjectFreq(ctx context.Context, key string) *IntCmd ObjectRefCount(ctx context.Context, key string) *IntCmd ObjectEncoding(ctx context.Context, key string) *StringCmd ObjectIdleTime(ctx context.Context, key string) *DurationCmd @@ -159,6 +160,12 @@ func (c cmdable) Move(ctx context.Context, key string, db int) *BoolCmd { return cmd } +func (c cmdable) ObjectFreq(ctx context.Context, key string) *IntCmd { + cmd := NewIntCmd(ctx, "object", "freq", key) + _ = c(ctx, cmd) + return cmd +} + func (c cmdable) ObjectRefCount(ctx context.Context, key string) *IntCmd { cmd := NewIntCmd(ctx, "object", "refcount", key) _ = c(ctx, cmd)