Reputation: 1473
I have a Redis set called userids
with over 100,000 entries in it.
When I run
redis-cli smembers userids | grep 12288357681
it returns a value like: 1324. 12288357681
This means that redis found the userid in the set.
But when I run:
redis-cli sismember userids 12288357681
it returns this: (integer) 0
This means that redis DID NOT find the userid in the set.
How is this possible? Am I using the sismember function incorrectly?
Upvotes: 1
Views: 1183
Reputation: 10015
Perhaps the value stored in your set is 1324. 12288357681
instead of just 12288357681
?
Check the below tests:
niloct@ubuntu:~$ redis-cli
redis 127.0.0.1:6379> sadd userids 12288357681
(integer) 1
redis 127.0.0.1:6379> exit
niloct@ubuntu:~$ redis-cli smembers userids | grep 12288357681
12288357681
niloct@ubuntu:~$ redis-cli sismember userids 12288357681
(integer) 1
Note the output of grep
, it is different from yours.
Upvotes: 1