Glob Patterns

54 views
Skip to first unread message

Manoj B. Narayanan

unread,
Oct 25, 2016, 5:22:30 AM10/25/16
to Redis DB
Hi all,

I would like to retrieve the keys by pattern matching. Is it possible that in a single query I can retrieve the keys that contain any one of the words in the pattern.

Example : Keys in redis - ADE, DCR, RTY, FGH

Hoe to write a single  pattern that gives me keys containing A or R?

Thanks

Salvatore Sanfilippo

unread,
Oct 25, 2016, 5:30:10 AM10/25/16
to redi...@googlegroups.com
Hello, blocking the server with KEYS is not recommended, however even
if you were willing to, there is no single "glob style" pattern to
match just the above strings, you can only match those strings plus
more strings, if you use, like: [ADRF][DCTG][ERYH], for example you'll
match ATE that was not your goal.
So the recommended way is to use four simultaneous iterators with
SCAN, all with a different MATCH option. Or use SCAN without MATCH and
match client-side.

Salvatore
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to redis-db+u...@googlegroups.com.
> To post to this group, send email to redi...@googlegroups.com.
> Visit this group at https://groups.google.com/group/redis-db.
> For more options, visit https://groups.google.com/d/optout.



--
Salvatore 'antirez' Sanfilippo
open source developer - Redis Labs https://redislabs.com

"If a system is to have conceptual integrity, someone must control the
concepts."
— Fred Brooks, "The Mythical Man-Month", 1975.

Manoj B. Narayanan

unread,
Oct 27, 2016, 4:10:48 AM10/27/16
to Redis DB
Hi,

Can we write a blog pattern with OR?

Eg. Retrieve all keys containing A or B. 

Thanks.
Reply all
Reply to author
Forward
0 new messages