Builds a cache, which either returns an already-loaded value for a given key or atomically computes or retrieves it using the supplied {@code CacheLoader}. If another thread is currently loading the value for this key, simply waits for that thread to finish and returns its loaded value. Note that mu
(
CacheLoader<? super K1, V1> loader)
| 1035 | * @return a cache having the requested features |
| 1036 | */ |
| 1037 | public <K1 extends K, V1 extends V> LoadingCache<K1, V1> build( |
| 1038 | CacheLoader<? super K1, V1> loader) { |
| 1039 | checkWeightWithWeigher(); |
| 1040 | return new LocalCache.LocalLoadingCache<>(this, loader); |
| 1041 | } |
| 1042 | |
| 1043 | /** |
| 1044 | * Builds a cache which does not automatically load values when keys are requested. |
no test coverage detected