Class SizedTimeoutCache<K,V>

java.lang.Object
com.hypixel.hytale.server.worldgen.util.cache.SizedTimeoutCache<K,V>
All Implemented Interfaces:
Cache<K,V>

public class SizedTimeoutCache<K,V> extends Object implements Cache<K,V>
Since:
2020/07/17
Version:
1.0
  • Constructor Details

    • SizedTimeoutCache

      public SizedTimeoutCache(long expire, @Nonnull TimeUnit unit, int maxSize, @Nullable Function<K,V> func, @Nullable BiConsumer<K,V> destroyer)
  • Method Details

    • cleanup

      public void cleanup()
      Specified by:
      cleanup in interface Cache<K,V>
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface Cache<K,V>
    • get

      @Nullable public V get(K key)
      Specified by:
      get in interface Cache<K,V>
    • put

      public void put(K key, V value)
    • getWithReusedKey

      @Nullable public V getWithReusedKey(K reusedKey, @Nonnull Function<K,K> keyPool)
      Takes a reused key and a way to generate a new key so that key allocation and be avoided unless the cache needs to be populated.