Record Class EvictionPolicy.WeightedPolicy<K,V>
java.lang.Object
java.lang.Record
cloud.opencode.base.cache.spi.EvictionPolicy.WeightedPolicy<K,V>
- Type Parameters:
K- key type | 键类型V- value type | 值类型- Record Components:
policy- the eviction policy | 淘汰策略weight- the weight for this policy | 此策略的权重
- Enclosing interface:
EvictionPolicy<K,V>
public static record EvictionPolicy.WeightedPolicy<K,V> (EvictionPolicy<K,V> policy, double weight)
extends Record
Weighted policy wrapper
加权策略包装器
- Since:
- JDK 25, opencode-base-cache V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
ConstructorsConstructorDescriptionWeightedPolicy(EvictionPolicy<K, V> policy, double weight) Creates an instance of aWeightedPolicyrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static <K,V> EvictionPolicy.WeightedPolicy <K, V> of(EvictionPolicy<K, V> policy, double weight) Creates a weighted policy | 创建加权策略policy()Returns the value of thepolicyrecord component.final StringtoString()Returns a string representation of this record class.doubleweight()Returns the value of theweightrecord component.
-
Constructor Details
-
Method Details
-
of
public static <K,V> EvictionPolicy.WeightedPolicy<K,V> of(EvictionPolicy<K, V> policy, double weight) Creates a weighted policy | 创建加权策略- Type Parameters:
K- the key type | 键类型V- the value type | 值类型- Parameters:
policy- the eviction policy | 淘汰策略weight- the weight | 权重- Returns:
- the weighted policy | 加权策略
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
policy
-
weight
-