public static <E> Set<E> newExpiringSet(long duration, TimeUnit unit) {
        return Collections.newSetFromMap(CaffeineFactory.newBuilder().expireAfterWrite(duration, unit).<E, Boolean>build().asMap());
    }
An expiring set using Caffeine caches

@param <E> the element type
@return a new expiring set
common/src/main/java/me/lucko/luckperms/common/util/ExpiringSet.java