public static final class ExpiringMap.Builder<K,V> extends Object
| Modifier and Type | Method and Description |
|---|---|
<K1 extends K,V1 extends V> |
build()
Builds and returns an expiring map.
|
<K1 extends K,V1 extends V> |
entryLoader(EntryLoader<? super K1,? super V1> loader)
Sets the EntryLoader to use when loading entries.
|
ExpiringMap.Builder<K,V> |
expiration(long duration,
TimeUnit timeUnit)
Sets the default map entry expiration.
|
<K1 extends K,V1 extends V> |
expirationListener(ExpirationListener<? super K1,? super V1> listener)
Sets the expiration listener which will receive notifications upon each map entry's expiration.
|
<K1 extends K,V1 extends V> |
expirationListeners(List<ExpirationListener<? super K1,? super V1>> listeners)
Sets expiration listeners which will receive notifications upon each map entry's expiration.
|
ExpiringMap.Builder<K,V> |
expirationPolicy(ExpirationPolicy expirationPolicy)
Sets the map entry expiration policy.
|
<K1 extends K,V1 extends V> |
expiringEntryLoader(ExpiringEntryLoader<? super K1,? super V1> loader)
Sets the ExpiringEntryLoader to use when loading entries and configures
variable
expiration. |
ExpiringMap.Builder<K,V> |
variableExpiration()
Allows for map entries to have individual expirations and for expirations to be changed.
|
public <K1 extends K,V1 extends V> ExpiringMap<K1,V1> build()
K1 - Key typeV1 - Value typepublic ExpiringMap.Builder<K,V> expiration(long duration, TimeUnit timeUnit)
duration - the length of time after an entry is created that it should be removedtimeUnit - the unit that duration is expressed inNullPointerException - if timeUnit is nullpublic <K1 extends K,V1 extends V> ExpiringMap.Builder<K1,V1> entryLoader(EntryLoader<? super K1,? super V1> loader)
loader - to setNullPointerException - if loader is nullIllegalStateException - if an ExpiringEntryLoader is setpublic <K1 extends K,V1 extends V> ExpiringMap.Builder<K1,V1> expiringEntryLoader(ExpiringEntryLoader<? super K1,? super V1> loader)
variable
expiration. Either an EntryLoader or ExpiringEntryLoader may be set, not both.loader - to setNullPointerException - if loader is nullIllegalStateException - if an EntryLoader is setpublic <K1 extends K,V1 extends V> ExpiringMap.Builder<K1,V1> expirationListener(ExpirationListener<? super K1,? super V1> listener)
listener - to setNullPointerException - if listener is nullpublic <K1 extends K,V1 extends V> ExpiringMap.Builder<K1,V1> expirationListeners(List<ExpirationListener<? super K1,? super V1>> listeners)
listeners - to setNullPointerException - if listener is nullpublic ExpiringMap.Builder<K,V> expirationPolicy(ExpirationPolicy expirationPolicy)
expirationPolicy - NullPointerException - if expirationPolicy is nullpublic ExpiringMap.Builder<K,V> variableExpiration()
Copyright © 2015. All rights reserved.