use invalidate instead of Map#remove

This commit is contained in:
xGinko 2024-07-09 14:13:17 +02:00
parent f652cb1d1c
commit 98b392d528

View File

@ -206,7 +206,7 @@ public final class ExpiringSet<E> extends AbstractSet<E> implements Set<E> {
@Override @Override
public boolean remove(Object o) { public boolean remove(Object o) {
boolean present = contains(o); boolean present = contains(o);
this.cache.asMap().remove(o); this.cache.invalidate(o);
return present; return present;
} }
@ -344,6 +344,6 @@ public final class ExpiringSet<E> extends AbstractSet<E> implements Set<E> {
*/ */
@Override @Override
public void clear() { public void clear() {
this.cache.asMap().clear(); this.cache.invalidateAll();
} }
} }