sravis
sravis

Reputation: 3680

Redis get DISTINCT keys using scan command

Using Redis scan command how do i get DISTINCT keys like below.

Data

hmset user_101_1 .. .. .. ..
hmset user_102_2 .. .. .. ..
hmset user_102_3 .. .. .. ..
hmset user_101_4 .. .. .. ..
hmset user_103_5 .. .. .. ..

Expected Result

user_101_1
user_102_2
user_103_5

Upvotes: 2

Views: 816

Answers (1)

Itamar Haber
Itamar Haber

Reputation: 49982

You can't - quoting from SCAN's documentation section about its guarantees:

A given element may be returned multiple times. It is up to the application to handle the case of duplicated elements...

Upvotes: 2

Related Questions