Home > Database > Redis > redis determines whether key exists

redis determines whether key exists

anonymity
Release: 2020-01-16 10:17:00
Original
39072 people have browsed it

The Redis EXISTS command is used to check whether a given key exists.

redis determines whether key exists

Recommended manualRedis command operation Chinese manual

redis EXISTS command The basic syntax is as follows:

redis 127.0.0.1:6379> EXISTS KEY_NAME

Available version>= 1.0.0

Return value

If the key exists, return 1, otherwise return 0.

Example

redis 127.0.0.1:6379> EXISTS w3cschoolcc-new-key
(integer) 0
Copy after login

Now we create a key named w3cschoolcc-new-key and assign a value, and then use the EXISTS command.

redis 127.0.0.1:6379> set w3cschoolcc-new-key newkey
OK
redis 127.0.0.1:6379> EXISTS w3cschoolcc-new-key
(integer) 1
redis 127.0.0.1:6379>
Copy after login
Recommended related articles:
1.How many keys can a redis instance store
2.Redis determines whether the value exists
Related video recommendations:
1.Yan Shiba redis video tutorial

The above is the detailed content of redis determines whether key 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