Class Cache.Builder<K,V>

java.lang.Object
com.booksaw.betterTeams.util.Cache.Builder<K,V>
Enclosing class:
Cache<K,V>

public static class Cache.Builder<K,V> extends Object
A builder for creating Cache instances.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • expireAfterWrite

      public Cache.Builder<K,V> expireAfterWrite(@NotNull @NotNull Duration duration)
      Sets the expiration time after writing an entry.
    • expireAfterAccess

      public Cache.Builder<K,V> expireAfterAccess(@NotNull @NotNull Duration duration)
      Sets the expiration time after accessing an entry.
    • maximumSize

      public Cache.Builder<K,V> maximumSize(int maximumSize)
      Sets the maximum size of the cache.
    • initialCapacity

      public Cache.Builder<K,V> initialCapacity(int initialCapacity)
      Sets the initial capacity of the cache.
    • build

      public Cache<K,V> build(Function<K,V> loader)
      Builds a new Cache instance.