Created
May 6, 2016 14:36
-
-
Save ctoestreich/827d21fcdefc03844489e9cbced4dbbd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // deletes all keys matching a pattern (see redis "keys" documentation for more) | |
| // OK for low traffic methods, but expensive compared to other redis commands | |
| // perf test before relying on this rather than storing your own set of keys to | |
| // delete | |
| void deleteKeysWithPattern(keyPattern) { | |
| if (log.infoEnabled) log.info("Cleaning all redis keys with pattern [${keyPattern}]") | |
| withRedis { Jedis redis -> | |
| String[] keys = redis.keys(keyPattern) | |
| if(keys) redis.del(keys) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment