Interface TtlPolicy
- All Known Implementing Classes:
TtlPolicy.AdaptiveTtl, TtlPolicy.Eternal, TtlPolicy.FixedTtl, TtlPolicy.PerKeyTtl, TtlPolicy.SlidingTtl
public sealed interface TtlPolicy
permits TtlPolicy.FixedTtl, TtlPolicy.SlidingTtl, TtlPolicy.AdaptiveTtl, TtlPolicy.PerKeyTtl, TtlPolicy.Eternal
Sealed interface defining various TTL (Time-To-Live) policies for cache entries.
Each policy determines how long an entry remains valid and how its TTL changes based on access patterns. Policies include:
- FixedTtl: constant TTL for all entries
- SlidingTtl: TTL resets on each access
- AdaptiveTtl: TTL based on access frequency (hot keys get longer TTL)
- PerKeyTtl: each key has individually set TTL
- Eternal: never expires
Implementations are immutable and thread-safe.
- Since:
- 1.5
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordAdaptive TTL policy: TTL based on access frequency.static final recordEternal policy: entries never expire.static final recordFixed TTL policy: entries have a constant TTL regardless of access.static final recordPer-key TTL policy: each key has its own individually set TTL.static final recordSliding TTL policy: TTL resets on each access.