Module io.github.bucket4j.core
Class Optimizations
- java.lang.Object
-
- io.github.bucket4j.distributed.proxy.optimization.Optimizations
-
public class Optimizations extends Object
Provides factory methods for all request optimizations that are built-in into Bucket4j library.
-
-
Constructor Summary
Constructors Constructor Description Optimizations()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optimizationbatching()Creates optimization that combines independent requests to same bucket into batches in order to reduce request count to remote storage.static Optimizationdelaying(DelayParameters delayParameters)Creates optimization that can serve requests locally without synchronization with external storage until thresholds are not violated.static Optimizationpredicting(DelayParameters delayParameters)Has the same semantic aspredicting(DelayParameters, PredictionParameters)but uses defaultPredictionParameters.static Optimizationpredicting(DelayParameters delayParameters, PredictionParameters predictionParameters)Creates optimization that can serve requests locally without synchronization with external storage until thresholds are not violated, and additionally tries to predict aggregated consumption rate in whole cluster in order to reduce the risk of overconsumption that caused byDelayOptimization.
-
-
-
Method Detail
-
batching
public static Optimization batching()
Creates optimization that combines independent requests to same bucket into batches in order to reduce request count to remote storage.- Returns:
- new instance of
BatchingOptimization - See Also:
BatchingOptimization
-
delaying
public static Optimization delaying(DelayParameters delayParameters)
Creates optimization that can serve requests locally without synchronization with external storage until thresholds are not violated.- Parameters:
delayParameters- thresholds that control whether or not request can be served locally without synchronization with external storage- Returns:
- new instance of
DelayOptimization - See Also:
DelayOptimization
-
predicting
public static Optimization predicting(DelayParameters delayParameters, PredictionParameters predictionParameters)
Creates optimization that can serve requests locally without synchronization with external storage until thresholds are not violated, and additionally tries to predict aggregated consumption rate in whole cluster in order to reduce the risk of overconsumption that caused byDelayOptimization.- Parameters:
delayParameters- thresholds that control whether or not request can be served locally without synchronization with external storagepredictionParameters- parameters that control the quality of prediction of distributed consumption rate- Returns:
- new instance of
PredictiveOptimization - See Also:
PredictiveOptimization,PredictionParameters,DelayParameters
-
predicting
public static Optimization predicting(DelayParameters delayParameters)
Has the same semantic aspredicting(DelayParameters, PredictionParameters)but uses defaultPredictionParameters.- Parameters:
delayParameters- thresholds that control whether or not request can be served locally without synchronization with external storage- Returns:
- new instance of
PredictiveOptimization - See Also:
PredictiveOptimization,PredictionParameters
-
-