Record Class EvictionPolicy.LFU<T>
java.lang.Object
java.lang.Record
cloud.opencode.base.pool.policy.EvictionPolicy.LFU<T>
- Type Parameters:
T- the pooled object type - 池化对象类型- Record Components:
minBorrowCount- the minimum borrow count - 最小借用次数
- All Implemented Interfaces:
EvictionPolicy<T>
- Enclosing interface:
EvictionPolicy<T>
public static record EvictionPolicy.LFU<T>(long minBorrowCount)
extends Record
implements EvictionPolicy<T>
Least Frequently Used eviction policy.
最不经常使用驱逐策略。
Evicts objects that have been borrowed fewer than minBorrowCount times.
驱逐借用次数少于minBorrowCount的对象。
- Since:
- JDK 25, opencode-base-pool V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Nested Class Summary
Nested classes/interfaces inherited from interface EvictionPolicy
EvictionPolicy.Composite<T>, EvictionPolicy.IdleTime<T>, EvictionPolicy.LFU<T>, EvictionPolicy.LRU<T>, EvictionPolicy.MaxAge<T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.booleanevict(PooledObject<T> obj, EvictionContext context) Determines if the object should be evicted.final inthashCode()Returns a hash code value for this object.longReturns the value of theminBorrowCountrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
LFU
public LFU(long minBorrowCount) Creates an instance of aLFUrecord class.- Parameters:
minBorrowCount- the value for theminBorrowCountrecord component
-
-
Method Details
-
evict
Description copied from interface:EvictionPolicyDetermines if the object should be evicted. 确定对象是否应被驱逐。- Specified by:
evictin interfaceEvictionPolicy<T>- Parameters:
obj- the pooled object - 池化对象context- the eviction context - 驱逐上下文- Returns:
- true if should evict - 如果应驱逐返回true
-
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. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
minBorrowCount
public long minBorrowCount()Returns the value of theminBorrowCountrecord component.- Returns:
- the value of the
minBorrowCountrecord component
-