Enum CacheStrategy
- java.lang.Object
-
- java.lang.Enum<CacheStrategy>
-
- com.codedstream.otterstream.inference.cache.CacheStrategy
-
- All Implemented Interfaces:
Serializable,Comparable<CacheStrategy>
public enum CacheStrategy extends Enum<CacheStrategy>
Defines caching strategies for ML inference operations in Otter Stream.Cache strategies determine how inference results are cached to improve performance and reduce redundant model computations. Choose the appropriate strategy based on your use case and data characteristics.
Usage Example:
CacheStrategy strategy = CacheStrategy.INPUT_HASH; System.out.println(strategy.getDescription());- Since:
- 1.0.0
- Author:
- Nestor Martourez, Sr Software and Data Streaming Engineer @ CodedStreams
-
-
Enum Constant Summary
Enum Constants Enum Constant Description FEATURE_BASEDCache based on specific feature values - granular caching controlINPUT_HASHCache based on hash of input features - best for identical inputsMODEL_OUTPUTCache model outputs for reuse - useful for frequently accessed predictionsNONENo caching - all inferences go directly to the model
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDescription()Gets the human-readable description of this caching strategy.static CacheStrategyvalueOf(String name)Returns the enum constant of this type with the specified name.static CacheStrategy[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NONE
public static final CacheStrategy NONE
No caching - all inferences go directly to the model
-
INPUT_HASH
public static final CacheStrategy INPUT_HASH
Cache based on hash of input features - best for identical inputs
-
MODEL_OUTPUT
public static final CacheStrategy MODEL_OUTPUT
Cache model outputs for reuse - useful for frequently accessed predictions
-
FEATURE_BASED
public static final CacheStrategy FEATURE_BASED
Cache based on specific feature values - granular caching control
-
-
Method Detail
-
values
public static CacheStrategy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CacheStrategy c : CacheStrategy.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CacheStrategy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getDescription
public String getDescription()
Gets the human-readable description of this caching strategy.- Returns:
- description of the caching approach
-
-