Module io.github.bucket4j.core
Class BatchingOptimization
- java.lang.Object
-
- io.github.bucket4j.distributed.proxy.optimization.batch.BatchingOptimization
-
- All Implemented Interfaces:
Optimization
public class BatchingOptimization extends Object implements Optimization
Optimization that combines independent requests to same bucket into batches in order to reduce request count to remote storage.
-
-
Field Summary
-
Fields inherited from interface io.github.bucket4j.distributed.proxy.optimization.Optimization
NONE_OPTIMIZED
-
-
Constructor Summary
Constructors Constructor Description BatchingOptimization(OptimizationListener listener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncCommandExecutorapply(AsyncCommandExecutor originalExecutor)Decorates command executor in order to apply optimization strategy.CommandExecutorapply(CommandExecutor originalExecutor)Decorates command executor in order to apply optimization strategy.OptimizationwithListener(OptimizationListener listener)Specifies the listener for optimization events
-
-
-
Constructor Detail
-
BatchingOptimization
public BatchingOptimization(OptimizationListener listener)
-
-
Method Detail
-
withListener
public Optimization withListener(OptimizationListener listener)
Description copied from interface:OptimizationSpecifies the listener for optimization events- Specified by:
withListenerin interfaceOptimization- Parameters:
listener- the listener for optimization events- Returns:
- the new instance of
Optimizationwith configured listener
-
apply
public CommandExecutor apply(CommandExecutor originalExecutor)
Description copied from interface:OptimizationDecorates command executor in order to apply optimization strategy.- Specified by:
applyin interfaceOptimization- Parameters:
originalExecutor- command executor that need to be optimized- Returns:
- decorated command executor
-
apply
public AsyncCommandExecutor apply(AsyncCommandExecutor originalExecutor)
Description copied from interface:OptimizationDecorates command executor in order to apply optimization strategy.- Specified by:
applyin interfaceOptimization- Parameters:
originalExecutor- command executor that need to be optimized- Returns:
- decorated command executor
-
-