Home > Database > Redis > body text

Redis determines whether the value exists

anonymity
Release: 2019-06-04 16:55:25
Original
14110 people have browsed it

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.
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template