Class ExpiringCache<T>

java.lang.Object
me.lucko.luckperms.common.cache.ExpiringCache<T>
Type Parameters:
T - the supplied type
All Implemented Interfaces:
Supplier<T>
Direct Known Subclasses:
QueryOptionsCache

public abstract class ExpiringCache<T> extends Object implements Supplier<T>
An expiring supplier extension.

The delegate supplier is only called on executions of get() if the result isn't already calculated.

  • Constructor Details

    • ExpiringCache

      protected ExpiringCache(long duration, TimeUnit unit)
  • Method Details

    • supply

      protected abstract @NonNull T supply()
    • get

      public T get()
      Specified by:
      get in interface Supplier<T>
    • invalidate

      public void invalidate()