Class Caches
java.lang.Object
ru.progrm_jarvis.javacommons.cache.Caches
Utility for creating commonly used caches depending on runtime capabilities.
If no cache is available then
no-op cache is used.-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull CacheFactoryGets the default cache factory.static <K,V> @NotNull Cache<K, V> Creates a new cache whose values will be storedsoftly.static <K,V> @NotNull Cache<K, V> Creates a new cache whose keys will be storedweakly.static <K,V> @NotNull Cache<K, V> Creates a new cache whose values will be storedweakly.
-
Method Details
-
defaultFactory
Gets the default cache factory.- Returns:
- default cache factory
-
weakKeysCache
Creates a new cache whose keys will be storedweakly.- Type Parameters:
K- type of cache keysV- type of cached values- Returns:
- weak keys cache
-
weakValuesCache
Creates a new cache whose values will be storedweakly.- Type Parameters:
K- type of cache keysV- type of cached values- Returns:
- weak values cache
-
softValuesCache
Creates a new cache whose values will be storedsoftly.- Type Parameters:
K- type of cache keysV- type of cached values- Returns:
- soft values cache
-