MCPcopy Index your code
hub / github.com/ebean-orm/ebean / clear

Method clear

ebean-redis/src/main/java/io/ebean/redis/RedisCache.java:231–258  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

229 }
230
231 @Override
232 public void clear() {
233 long start = System.nanoTime();
234 try (Jedis resource = jedisPool.getResource()) {
235 ScanParams params = new ScanParams();
236 params.match(cacheKey + ":*");
237
238 String next;
239 byte[] nextCursor = CURSOR_0_BYTES;
240 do {
241 ScanResult<byte[]> scanResult = resource.scan(nextCursor, params);
242 List<byte[]> keys = scanResult.getResult();
243 nextCursor = scanResult.getCursorAsBytes();
244
245 if (!keys.isEmpty()) {
246 byte[][] raw = new byte[keys.size()][];
247 for (int i = 0; i < keys.size(); i++) {
248 raw[i] = keys.get(i);
249 }
250 resource.del(raw);
251 }
252 next = SafeEncoder.encode(nextCursor);
253 } while (!next.equals("0"));
254 metricClear.addSinceNanos(start);
255 } catch (Exception e) {
256 errorOnWrite(e);
257 }
258 }
259
260 private byte[][] keysAsBytes(Collection<Object> keys) {
261 byte[][] raw = new byte[keys.size()][];

Callers 1

expirationMethod · 0.95

Calls 8

errorOnWriteMethod · 0.95
matchMethod · 0.65
isEmptyMethod · 0.65
sizeMethod · 0.65
getMethod · 0.65
encodeMethod · 0.65
addSinceNanosMethod · 0.65
equalsMethod · 0.45

Tested by 1

expirationMethod · 0.76