replace an internal class by a record in PlayerFinder

This commit is contained in:
Marc Baloup 2022-03-17 22:59:45 +01:00
parent 4edf759bd3
commit 6ef8557c34
Signed by: marcbal
GPG Key ID: BBC0FE3ABC30B893

View File

@ -37,16 +37,7 @@ public class PlayerFinder {
.maximumSize(1000) .maximumSize(1000)
.build(); .build();
//record PlayerIdCacheKey(String pName, boolean old) { } // Java 16 record PlayerIdCacheKey(String pName, boolean old) { }
static class PlayerIdCacheKey {
private final String pName;
private final boolean old;
public PlayerIdCacheKey(String pName, boolean old) {
this.pName = pName; this.old = old;
}
public String pName() { return pName; }
public boolean old() { return old; }
}
private static Cache<PlayerIdCacheKey, UUID> playerId = CacheBuilder.newBuilder() private static Cache<PlayerIdCacheKey, UUID> playerId = CacheBuilder.newBuilder()
.expireAfterWrite(2, TimeUnit.MINUTES) .expireAfterWrite(2, TimeUnit.MINUTES)
.maximumSize(1000) .maximumSize(1000)