lily
lily

Reputation: 565

How to delete a list of keys in Redis using Java/Spring APIs and return whether all keys delete or not?

I have a logic which needs to delete a list of keys in Redis cache and I want to know whether all keys are deleted or not (if all of them deleted successfully, I want to get result "true", but if some of them are not deleted successfully, I want to get result "false").

I'm wondering are there any relatively easy workaround for such a logic with java/spring apis? thanks!

Upvotes: 0

Views: 2459

Answers (1)

tabreaz
tabreaz

Reputation: 659

redis DEL command returns number of keys deleted.

You can pass small batches such as 100 keys per DEL call and count the return value to be exact of the batch size.

Upvotes: 1

Related Questions