Are there any ways to check whether a key exists with RedisTemplate?

Lily :

Are there any ways to check whether a key exists with RedisTemplate? or in other words, are there any equivalent of Redis exists command in RedisTemplate API?

Mobility :

Yes, you can use public Boolean hasKey(K key).

You can just search exists in redisTemplate javadoc

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=472774&siteId=1