From e62a7de6e319d2b4e897eacfc049efdc65c22fe7 Mon Sep 17 00:00:00 2001 From: RayzsYT <51991564+RayzsYT@users.noreply.github.com> Date: Sun, 12 May 2024 00:33:58 +0200 Subject: [PATCH] Remove --- .../java/de/rayzs/pat/utils/ExpireList.java | 41 ------------------- 1 file changed, 41 deletions(-) delete mode 100644 src/main/java/de/rayzs/pat/utils/ExpireList.java diff --git a/src/main/java/de/rayzs/pat/utils/ExpireList.java b/src/main/java/de/rayzs/pat/utils/ExpireList.java deleted file mode 100644 index 3ffb3e6e..00000000 --- a/src/main/java/de/rayzs/pat/utils/ExpireList.java +++ /dev/null @@ -1,41 +0,0 @@ -package de.rayzs.pat.utils; - - -import com.google.common.cache.*; -import java.util.concurrent.TimeUnit; - -public class ExpireList { - - private final Cache cache; - - public ExpireList(long expireTime, TimeUnit timeUnit) { - cache = CacheBuilder.newBuilder().concurrencyLevel(2).expireAfterWrite(expireTime, timeUnit).build(); - } - - public ExpireList(ExpireList expireList) { - cache = expireList.getCache(); - } - - public boolean add(T t) { - if(contains(t)) return false; - cache.put(t, (byte) 0); - return true; - } - - public void addIgnoreIfContains(T t) { - cache.put(t, (byte) 0); - } - - public int getSize() { - cache.cleanUp(); - return (int) cache.size(); - } - - public Cache getCache() { - return cache; - } - - public boolean contains(T t) { - return cache.getIfPresent(t) != null; - } -}