Hi. I'm using redis with springboot. @cacheEvict, is there a way to clear the cache of the corresponding key using regex or wildcard?

I'm sorry if this is a post to ask on the springboot forum. I think I should check the redis board as well. Whether redis provides a feature for SPEL.

thanks in advance for answer

Comment From: sundb

@developerdongminkim Now redis does not support using wildcards to delete all matched keys at once, but you can do this with scan and del.

Pseudocode:

cursor = 0
while (1) {
    keys, cursor = scan cursor count
    del keys
}

Note: Never use keys patten to match all keys, as it's very very slow and will cause block redis.

Comment From: developerdongminkim

@sundb

thanks. I googled about scan and it says that ** it doesn't work in cluster mode**. am I right?

I guess I'll have to find out how to use this in java again.

Comment From: sundb

@developerdongminkim Yeah, but you can iterate throught all nodes, and then do the same thing.

Comment From: developerdongminkim

Your answer is simple, but it helped me a lot in my decision making. thank you so much