Module io.github.bucket4j.core
Interface Optimization
- All Known Implementing Classes:
BatchingOptimization,DelayOptimization,ManuallySyncingOptimization,PredictiveOptimization,SkipSyncOnZeroOptimization
public interface Optimization
Specifies request optimization strategy for
BucketProxy and AsyncBucketProxy.
By default, an interaction with BucketProxy and AsyncBucketProxy leads to immediately request to remote storage,
various implementations of Optimization interface can optimize this behavior.- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionapply(AsyncCommandExecutor originalExecutor) Decorates command executor in order to apply optimization strategy.apply(CommandExecutor originalExecutor) Decorates command executor in order to apply optimization strategy.withListener(OptimizationListener listener) Specifies the listener for optimization events
-
Field Details
-
NONE_OPTIMIZED
-
-
Method Details
-
withListener
Specifies the listener for optimization events- Parameters:
listener- the listener for optimization events- Returns:
- the new instance of
Optimizationwith configured listener
-
apply
Decorates command executor in order to apply optimization strategy.- Parameters:
originalExecutor- command executor that need to be optimized- Returns:
- decorated command executor
-
apply
Decorates command executor in order to apply optimization strategy.- Parameters:
originalExecutor- command executor that need to be optimized- Returns:
- decorated command executor
-