Class Caches

java.lang.Object
ru.progrm_jarvis.javacommons.cache.Caches

public final class Caches extends Object
Utility for creating commonly used caches depending on runtime capabilities. If no cache is available then no-op cache is used.
  • Method Details

    • defaultFactory

      @NotNull public static @NotNull CacheFactory defaultFactory()
      Gets the default cache factory.
      Returns:
      default cache factory
    • weakKeysCache

      @NotNull public static <K, V> @NotNull Cache<K,V> weakKeysCache()
      Creates a new cache whose keys will be stored weakly.
      Type Parameters:
      K - type of cache keys
      V - type of cached values
      Returns:
      weak keys cache
    • weakValuesCache

      @NotNull public static <K, V> @NotNull Cache<K,V> weakValuesCache()
      Creates a new cache whose values will be stored weakly.
      Type Parameters:
      K - type of cache keys
      V - type of cached values
      Returns:
      weak values cache
    • softValuesCache

      @NotNull public static <K, V> @NotNull Cache<K,V> softValuesCache()
      Creates a new cache whose values will be stored softly.
      Type Parameters:
      K - type of cache keys
      V - type of cached values
      Returns:
      soft values cache