Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In order to obtain the score value from a key name in a sorted set in Redis, you can use the ZSCORE command followed by the name of the sorted set and the key name.

The syntax for ZSCORE command is:

ZSCORE key member

For example, if you have a sorted set named "myset" with the following values:

redis> ZADD myset 10 "key1"
(integer) 1
redis> ZADD myset 20 "key2"
(integer) 1

You can obtain the score value of "key1" by using the following command:

redis> ZSCORE myset key1
"10"

This command will return the score value of "key1" which is 10.