Class LruCache<K,V>

java.lang.Object
io.helidon.common.configurable.LruCache<K,V>
Type Parameters:
K - type of the keys of the map
V - type of the values of the map
All Implemented Interfaces:
RuntimeType.Api<LruCacheConfig<K,V>>, LruCache<K,V>

@Deprecated(forRemoval=true, since="4.2.0") public final class LruCache<K,V> extends Object implements LruCache<K,V>, RuntimeType.Api<LruCacheConfig<K,V>>
Deprecated, for removal: This API element is subject to removal in a future version.
kindly use LruCache, we are removing this from the configurable module, as cache has only a single option, and we need it from modules that do not use configuration
Least recently used cache. This cache has a capacity. When the capacity is reached, the oldest record is removed from the cache when a new one is added.
  • Field Summary

    Fields inherited from interface io.helidon.common.LruCache

    DEFAULT_CAPACITY
  • Method Summary

    Modifier and Type
    Method
    Description
    static <K, V> LruCacheConfig.Builder<K,V>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create a new builder.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    computeValue(K key, Supplier<Optional<V>> valueSupplier)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static <K, V> LruCache<K,V>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create an instance with default configuration.
    static <K, V> LruCache<K,V>
    create(LruCacheConfig<K,V> config)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create an instance with custom configuration.
    static <K, V> LruCache<K,V>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create an instance with custom configuration.
    get(K key)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    put(K key, V value)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    remove(K key)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • builder

      public static <K, V> LruCacheConfig.Builder<K,V> builder()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a new builder.
      Type Parameters:
      K - key type
      V - value type
      Returns:
      a new fluent API builder instance
    • create

      public static <K, V> LruCache<K,V> create()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create an instance with default configuration.
      Type Parameters:
      K - key type
      V - value type
      Returns:
      a new cache instance
      See Also:
    • create

      public static <K, V> LruCache<K,V> create(LruCacheConfig<K,V> config)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create an instance with custom configuration.
      Type Parameters:
      K - key type
      V - value type
      Parameters:
      config - configuration of LRU cache
      Returns:
      a new cache instance
    • create

      public static <K, V> LruCache<K,V> create(Consumer<LruCacheConfig.Builder<K,V>> consumer)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create an instance with custom configuration.
      Type Parameters:
      K - key type
      V - value type
      Parameters:
      consumer - of custom configuration builder
      Returns:
      a new cache instance
    • prototype

      public LruCacheConfig<K,V> prototype()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      prototype in interface RuntimeType.Api<K>
    • get

      public Optional<V> get(K key)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      get in interface LruCache<K,V>
    • remove

      public Optional<V> remove(K key)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      remove in interface LruCache<K,V>
    • put

      public Optional<V> put(K key, V value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      put in interface LruCache<K,V>
    • computeValue

      public Optional<V> computeValue(K key, Supplier<Optional<V>> valueSupplier)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      computeValue in interface LruCache<K,V>
    • size

      public int size()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      size in interface LruCache<K,V>
    • capacity

      public int capacity()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      capacity in interface LruCache<K,V>
    • clear

      public void clear()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      clear in interface LruCache<K,V>