CacheEvictionPolicy enum
缓存淘汰策略枚举
用于配置缓存达到最大容量时的淘汰行为。
final config = RxNetConfig(
baseUrl: "https://api.example.com",
cacheMaxSize: 500,
cacheEvictionPolicy: CacheEvictionPolicy.lru,
);
await RxNet.init(config: config);
Values
- none → const CacheEvictionPolicy
-
不淘汰(默认),缓存条目不受数量限制
- lru → const CacheEvictionPolicy
-
最近最少使用(Least Recently Used) 淘汰最后访问时间最久远的条目
- lfu → const CacheEvictionPolicy
-
最不经常使用(Least Frequently Used) 淘汰访问次数最少的条目;次数相同时退化为 FIFO
- fifo → const CacheEvictionPolicy
-
先进先出(First In First Out) 淘汰最早创建的条目
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
CacheEvictionPolicy> - A constant List of the values in this enum, in order of their declaration.