14

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?

Lily
  • 355
  • 1
  • 3
  • 11

1 Answers1

22

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

You can just search exists in redisTemplate javadoc

Mobility
  • 3,117
  • 18
  • 31