Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get a list of streams?

Tags:

redis

I need to get a list of all streams (keys) in a database but I can't find a command for it.

I've already tried going over all keys and checking their typebut it is too slow/expensive.

I'd like to do something like XSCAN and get a list of keys like: ["stream1", "stream2"]

like image 317
aemadrid Avatar asked Jan 09 '19 00:01

aemadrid


1 Answers

As of version 6.0 you can use the TYPE option to ask SCAN to only return objects that match a given type.

SCAN 0 TYPE stream

https://redis.io/commands/scan

like image 91
Madis V Avatar answered Sep 19 '22 12:09

Madis V