/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. Its {@link Cache#asMap} view will therefore * technically violate the {@link Map} specification (in the same way that {@link IdentityHashMap} * does). * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible // java.lang.ref.WeakReference public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. Its {@link Cache#asMap} view will therefore * technically violate the {@link Map} specification (in the same way that {@link IdentityHashMap} * does). * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible // java.lang.ref.WeakReference public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. Its {@link Cache#asMap} view will therefore * technically violate the {@link Map} specification (in the same way that {@link IdentityHashMap} * does). * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible // java.lang.ref.WeakReference public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
CacheBuilder<K, V> recreateCacheBuilder() { CacheBuilder<K, V> builder = CacheBuilder.newBuilder() .setKeyStrength(keyStrength) .setValueStrength(valueStrength) .keyEquivalence(keyEquivalence)
CacheBuilder<K, V> recreateCacheBuilder() { CacheBuilder<K, V> builder = CacheBuilder.newBuilder() .setKeyStrength(keyStrength) .setValueStrength(valueStrength) .keyEquivalence(keyEquivalence)
CacheBuilder<K, V> recreateCacheBuilder() { CacheBuilder<K, V> builder = CacheBuilder.newBuilder() .setKeyStrength(keyStrength) .setValueStrength(valueStrength) .keyEquivalence(keyEquivalence)
builder.setKeyStrength(keyStrength);
/** * Specifies that each key (not value) stored in the cache should be strongly referenced. * * @throws IllegalStateException if the key strength was already set */ CacheBuilder<K, V> strongKeys() { return setKeyStrength(Strength.STRONG); }
/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible("java.lang.ref.WeakReference") public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. Its {@link Cache#asMap} view will therefore * technically violate the {@link Map} specification (in the same way that {@link IdentityHashMap} * does). * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible // java.lang.ref.WeakReference public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
/** * Specifies that each key (not value) stored in the cache should be wrapped in a {@link * WeakReference} (by default, strong references are used). * * <p><b>Warning:</b> when this method is used, the resulting cache will use identity ({@code ==}) * comparison to determine equality of keys. Its {@link Cache#asMap} view will therefore * technically violate the {@link Map} specification (in the same way that {@link IdentityHashMap} * does). * * <p>Entries with keys 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 key strength was already set */ @GwtIncompatible // java.lang.ref.WeakReference public CacheBuilder<K, V> weakKeys() { return setKeyStrength(Strength.WEAK); }
CacheBuilder<K, V> recreateCacheBuilder() { CacheBuilder<K, V> builder = CacheBuilder.newBuilder() .setKeyStrength(keyStrength) .setValueStrength(valueStrength) .keyEquivalence(keyEquivalence)