Module io.github.bucket4j.core
Class ProxyManagerView<K,KeyOld>
java.lang.Object
io.github.bucket4j.distributed.proxy.ProxyManagerView<K,KeyOld>
- All Implemented Interfaces:
ProxyManager<K>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasAsync()Returns asynchronous API for this proxy manager.builder()Creates new instance ofRemoteBucketBuilder.getProxy(K key, Supplier<BucketConfiguration> configurationSupplier) Creates bucket-proxy that configured by default parameters that set on proxy-manager level.getProxyConfiguration(K key) Locates configuration of bucket which actually stored in the underlying storage.booleanDescribes whether this manager supports asynchronous API.booleanDescribes whether this manager supports expire-after-write feature.voidremoveProxy(K key) Removes persisted state of bucket from underlying storage.<K2> ProxyManager<K2>withMapper(Function<? super K2, ? extends K> innerMapper) Returns a proxy object that wraps this ProxyManager such that keys are first mapped using the specified mapping function before being sent to the remote store.
-
Constructor Details
-
ProxyManagerView
-
-
Method Details
-
getProxy
Description copied from interface:ProxyManagerCreates bucket-proxy that configured by default parameters that set on proxy-manager level. In case if you need to configure something special for bucket like implicit config replacement you should to useProxyManager.builder()instead of this method.- Specified by:
getProxyin interfaceProxyManager<K>- Parameters:
key- the key that used in external storage to distinguish one bucket from another.configurationSupplier- provider for bucket configuration- Returns:
- new instance of
BucketProxy
-
builder
Description copied from interface:ProxyManagerCreates new instance ofRemoteBucketBuilder.Use this method only if you need to create bucket with parameters that can not be specified via
AbstractProxyManagerBuilder, otherwise preferProxyManager.getProxy(Object, Supplier)- Specified by:
builderin interfaceProxyManager<K>- Returns:
- new instance of
RemoteBucketBuilder
-
getProxyConfiguration
Description copied from interface:ProxyManagerLocates configuration of bucket which actually stored in the underlying storage.- Specified by:
getProxyConfigurationin interfaceProxyManager<K>- Parameters:
key- the unique identifier used to point to the bucket in external storage.- Returns:
- Optional surround the configuration or empty optional if bucket with specified key is not stored.
-
removeProxy
Description copied from interface:ProxyManagerRemoves persisted state of bucket from underlying storage.- Specified by:
removeProxyin interfaceProxyManager<K>- Parameters:
key- the primary key of bucket which state need to be removed from underlying storage.
-
isAsyncModeSupported
public boolean isAsyncModeSupported()Description copied from interface:ProxyManagerDescribes whether this manager supports asynchronous API. If this method returnsfalsethen any invocation ofProxyManager.asAsync()will throwUnsupportedOperationException.- Specified by:
isAsyncModeSupportedin interfaceProxyManager<K>- Returns:
trueif this manager supports asynchronous API
-
isExpireAfterWriteSupported
public boolean isExpireAfterWriteSupported()Description copied from interface:ProxyManagerDescribes whether this manager supports expire-after-write feature.- Specified by:
isExpireAfterWriteSupportedin interfaceProxyManager<K>- Returns:
trueif this manager supports expire-after-write feature.
-
asAsync
Description copied from interface:ProxyManagerReturns asynchronous API for this proxy manager.- Specified by:
asAsyncin interfaceProxyManager<K>- Returns:
- asynchronous API for this proxy manager.
- Throws:
UnsupportedOperationException- in case of this proxy manager does not support Async API.
-
withMapper
Description copied from interface:ProxyManagerReturns a proxy object that wraps this ProxyManager such that keys are first mapped using the specified mapping function before being sent to the remote store. The returned ProxyManager shares the same underlying store as the original, and keys that map to the same value will share the same remote state.- Specified by:
withMapperin interfaceProxyManager<K>- Type Parameters:
K2- the type of key accepted by returned ProxyManager- Parameters:
innerMapper- the mapper function to apply to keys- Returns:
- a proxy object that wraps this ProxyManager
-