/** * Specifies that each value (not key) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p>Weak values will be garbage collected once they are weakly reachable. This makes them a poor * candidate for caching; consider {@link #softValues} instead. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @return this {@code CacheBuilder} instance (for chaining) * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible // java.lang.ref.WeakReference public CacheBuilder<K, V> weakValues() { return setValueStrength(Strength.WEAK); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a {@link * SoftReference} (by default, strong references are used). Softly-referenced objects will be * garbage-collected in a <i>globally</i> least-recently-used manner, in response to memory * demand. * * <p><b>Warning:</b> in most circumstances it is better to set a per-cache {@linkplain * #maximumSize(long) maximum size} instead of using soft references. You should only use this * method if you are well familiar with the practical consequences of soft references. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @return this {@code CacheBuilder} instance (for chaining) * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible // java.lang.ref.SoftReference public CacheBuilder<K, V> softValues() { return setValueStrength(Strength.SOFT); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p>Weak values will be garbage collected once they are weakly reachable. This makes them a poor * candidate for caching; consider {@link #softValues} instead. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @return this {@code CacheBuilder} instance (for chaining) * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible // java.lang.ref.WeakReference public CacheBuilder<K, V> weakValues() { return setValueStrength(Strength.WEAK); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a {@link * SoftReference} (by default, strong references are used). Softly-referenced objects will be * garbage-collected in a <i>globally</i> least-recently-used manner, in response to memory * demand. * * <p><b>Warning:</b> in most circumstances it is better to set a per-cache {@linkplain * #maximumSize(long) maximum size} instead of using soft references. You should only use this * method if you are well familiar with the practical consequences of soft references. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @return this {@code CacheBuilder} instance (for chaining) * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible // java.lang.ref.SoftReference public CacheBuilder<K, V> softValues() { return setValueStrength(Strength.SOFT); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p>Weak values will be garbage collected once they are weakly reachable. This makes them a poor * candidate for caching; consider {@link #softValues} instead. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @return this {@code CacheBuilder} instance (for chaining) * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible // java.lang.ref.WeakReference public CacheBuilder<K, V> weakValues() { return setValueStrength(Strength.WEAK); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a {@link * SoftReference} (by default, strong references are used). Softly-referenced objects will be * garbage-collected in a <i>globally</i> least-recently-used manner, in response to memory * demand. * * <p><b>Warning:</b> in most circumstances it is better to set a per-cache {@linkplain * #maximumSize(long) maximum size} instead of using soft references. You should only use this * method if you are well familiar with the practical consequences of soft references. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @return this {@code CacheBuilder} instance (for chaining) * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible // java.lang.ref.SoftReference public CacheBuilder<K, V> softValues() { return setValueStrength(Strength.SOFT); }
CacheBuilder.newBuilder() .setKeyStrength(keyStrength) .setValueStrength(valueStrength) .keyEquivalence(keyEquivalence) .valueEquivalence(valueEquivalence)
CacheBuilder.newBuilder() .setKeyStrength(keyStrength) .setValueStrength(valueStrength) .keyEquivalence(keyEquivalence) .valueEquivalence(valueEquivalence)
CacheBuilder.newBuilder() .setKeyStrength(keyStrength) .setValueStrength(valueStrength) .keyEquivalence(keyEquivalence) .valueEquivalence(valueEquivalence)
builder.setValueStrength(valueStrength);
/** * Specifies that each value (not key) stored in the cache should be strongly referenced. * * @throws IllegalStateException if the value strength was already set */ CacheBuilder<K, V> strongValues() { return setValueStrength(Strength.STRONG); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a * {@link WeakReference} (by default, strong references are used). * * <p>Weak values will be garbage collected once they are weakly reachable. This makes them a poor * candidate for caching; consider {@link #softValues} instead. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakValues() { return setValueStrength(Strength.WEAK); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a * {@link WeakReference} (by default, strong references are used). * * <p>Weak values will be garbage collected once they are weakly reachable. This makes them a poor * candidate for caching; consider {@link #softValues} instead. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakValues() { return setValueStrength(Strength.WEAK); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a * {@link WeakReference} (by default, strong references are used). * * <p>Weak values will be garbage collected once they are weakly reachable. This makes them a poor * candidate for caching; consider {@link #softValues} instead. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakValues() { return setValueStrength(Strength.WEAK); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a * {@link WeakReference} (by default, strong references are used). * * <p>Weak values will be garbage collected once they are weakly reachable. This makes them a poor * candidate for caching; consider {@link #softValues} instead. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakValues() { return setValueStrength(Strength.WEAK); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a * {@link WeakReference} (by default, strong references are used). * * <p>Weak values will be garbage collected once they are weakly reachable. This makes them a poor * candidate for caching; consider {@link #softValues} instead. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakValues() { return setValueStrength(Strength.WEAK); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a * {@link WeakReference} (by default, strong references are used). * * <p>Weak values will be garbage collected once they are weakly reachable. This makes them a poor * candidate for caching; consider {@link #softValues} instead. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakValues() { return setValueStrength(Strength.WEAK); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a * {@link WeakReference} (by default, strong references are used). * * <p>Weak values will be garbage collected once they are weakly reachable. This makes them a poor * candidate for caching; consider {@link #softValues} instead. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakValues() { return setValueStrength(Strength.WEAK); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a * {@link WeakReference} (by default, strong references are used). * * <p>Weak values will be garbage collected once they are weakly reachable. This makes them a poor * candidate for caching; consider {@link #softValues} instead. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakValues() { return setValueStrength(Strength.WEAK); }
/** * Specifies that each value (not key) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p>Weak values will be garbage collected once they are weakly reachable. This makes them a poor * candidate for caching; consider {@link #softValues} instead. * * <p><b>Note:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of values. * * <p>Entries with values that have been garbage collected may be counted in {@link Cache#size}, * but will never be visible to read or write operations; such entries are cleaned up as part of * the routine maintenance described in the class javadoc. * * @return this {@code CacheBuilder} instance (for chaining) * @throws IllegalStateException if the value strength was already set */ @GwtIncompatible // java.lang.ref.WeakReference public CacheBuilder<K, V> weakValues() { return setValueStrength(Strength.WEAK); }