Browse Source

add RedisService.del_matching

tags/2.0.1
Jonathan Cobb 4 years ago
parent
commit
9aa42648fc
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      wizard-server/src/main/java/org/cobbzilla/wizard/cache/redis/RedisService.java

+ 9
- 1
wizard-server/src/main/java/org/cobbzilla/wizard/cache/redis/RedisService.java View File

@@ -176,6 +176,14 @@ public class RedisService {
public Long del(String key) { return __del(key, 0, MAX_RETRIES); } public Long del(String key) { return __del(key, 0, MAX_RETRIES); }
public Long del_withPrefix(String prefixedKey) { return __del(prefixedKey, 0, MAX_RETRIES, false); } public Long del_withPrefix(String prefixedKey) { return __del(prefixedKey, 0, MAX_RETRIES, false); }


public Long del_matching(String keyMatch) {
Long count = 0L;
for (String key : keys(keyMatch)) {
count += del_withPrefix(key);
}
return count;
}

public Long sadd(String key, String value) { return sadd(key, new String[]{value}); } public Long sadd(String key, String value) { return sadd(key, new String[]{value}); }
public Long sadd(String key, String[] values) { return __sadd(key, values, 0, MAX_RETRIES); } public Long sadd(String key, String[] values) { return __sadd(key, values, 0, MAX_RETRIES); }


@@ -753,6 +761,6 @@ public class RedisService {
} }
} }


public void flush() { keys(ALL_KEYS).forEach(this::del_withPrefix); }
public void flush() { del_matching(ALL_KEYS); }


} }

Loading…
Cancel
Save