Home  >  Article  >  Database  >  Redis determines whether the value exists

Redis determines whether the value exists

anonymity
anonymityOriginal
2019-06-04 16:55:2514115browse

Redis supports five data types:

string (string)

hash (hash)

list (list)

set ( Set)

zset(sorted set: ordered set)

Redis determines whether the value exists

redis determines whether the value exists

In SISMEMBER in the set and ZRANK, ZREVRANK, and ZSCORE in the ordered set can all determine whether a member is in the set!

Example:

The set command in redis to determine whether a certain value exists in the value of a certain key: sismember, if it exists, it returns 1, if it does not exist, it returns 1 Return 0

127.0.0.1:6379>sismember mySet 3  ---返回值为0,因为myset的set成员中只有1,2没有3
127.0.0.1:6379>sismember mySet 2   ---返回值为1,因为myset的Set成员中存在2.

The above is the detailed content of Redis determines whether the value exists. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn