in jetcache-support/jetcache-redis/src/main/java/com/alicp/jetcache/redis/RedisCache.java [354:385]
protected CacheResult do_REMOVE_ALL(Set<? extends K> keys) {
if (keys == null || keys.isEmpty()) {
return CacheResult.SUCCESS_WITHOUT_MSG;
}
long[] count = new long[1];
try {
KeyBinaryCommands writeCommands = (KeyBinaryCommands) writeCommands();
byte[][] newKeys = keys.stream().map((k) -> buildKey(k)).toArray((len) -> new byte[keys.size()][]);
return this.<KeyBinaryCommands, KeyPipelineBinaryCommands, CacheResult>doWithPipeline(writeCommands, false, (pipeline) -> {
if (pipeline != null) {
for (byte[] newKey : newKeys) {
pipeline.del(newKey);
count[0]++;
}
sync(pipeline);
} else {
writeCommands.del(newKeys);
}
return CacheResult.SUCCESS_WITHOUT_MSG;
});
} catch (Exception ex) {
logError("REMOVE_ALL", "keys(" + keys.size() + ")", ex);
if (count[0] > 0) {
return new CacheResult(CacheResultCode.PART_SUCCESS, ex.toString());
} else {
return new CacheResult(ex);
}
}
}