Using the cli on a database that's been a while since last time I had to deal with, I got myself wanting to just print the value of a key (just like you can console.dir some variable in JavaScript).

So I routinely do TYPE, to then do a GET/LRANGE/SMEMBERS/etc on the key. Would a command to take a peek into the value of a key (of any type) something worth implementing?

I asked the same thing on reddit some years ago, but custom lua scripting or using DUMP are not really good alternatives.

Comment From: laixintao

Hi, I have the same idea as yours. But redis-cli only send one command a time.

I started a new project (called iredis) that enhance redis-cli last year, it's useable now.

The idea is, I will implement a command called "PEEK" to check TYPE then use GET/LRANGE/... to get the details, if the list or set is too long, I will only show like LRANGE 0 3 and LRANGE -3 -1 and omit the middles.

How does that sound to you?


My works here: https://github.com/laixintao/iredis

ideas: https://github.com/laixintao/iredis/issues/6

Comment From: tallesl

Sounds good. Still a bit of bummer not getting something like that out of the box with redis-cli though.

Comment From: laixintao

Agreed

On Tue, Jan 7, 2020 at 12:37 AM Talles L notifications@github.com wrote:

Sounds good. Still a bit of bummer not getting something like that out of the box with redis-cli though.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/antirez/redis/issues/6720?email_source=notifications&email_token=ACJ2JI6D7KEZWM57WKN4Q4LQ4NM2XA5CNFSM4KBWZ7F2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIF7U4Y#issuecomment-571210355, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACJ2JIZLON64FQGBTF3FB4DQ4NM2XANCNFSM4KBWZ7FQ .

Comment From: wjdavis5

I started working on a redis module for this: https://github.com/wjdavis5/RedisPeek

Comment From: hwware

This is a great idea, rather than only showing the value of object, maybe if the cli also explicitly shows the type of the object will be useful for clients...

Comment From: wjdavis5

@hwware - that is what it currently does, albeit only for string values currently.

Comment From: laixintao

Hi I just implemented a PEEK command, information include:

  • type
  • memory usage
  • len/llen/cardinality
  • values

Screen Shot 2020-02-14 at 11 08 26 PM Screen Shot 2020-02-14 at 11 08 13 PM

Try with iredis: - https://github.com/laixintao/iredis