Interface ToolIndexEvictionStrategy
- All Known Implementing Classes:
AlwaysEvictStrategy,CompositeEvictionStrategy,LruEvictionStrategy,NeverEvictStrategy,TtlEvictionStrategy
onAccess(String) is called at the start of every request. Any session IDs it
returns are cleared from the ToolIndex, after which onRemoved(String)
is called so the strategy can drop its own internal tracking state.
Common strategies include: never evicting (indexes persist until explicitly removed), always evicting (fresh re-index on every request), LRU eviction (cap on active session count), TTL eviction (idle sessions expire after a configured duration), and composite eviction (union of multiple strategies).
- Since:
- 2.0.0
- Author:
- Christian Tzolov
-
Method Summary
Modifier and TypeMethodDescriptionCalled each time a session is accessed at the start of request processing.voidCalled after a session's tool index has been cleared — either because this strategy returned it fromonAccess(java.lang.String), or because of an explicit eviction request.
-
Method Details
-
onAccess
Called each time a session is accessed at the start of request processing.Implementations should update their internal tracking state for
sessionIdand return the set of session IDs whose tool indexes must now be cleared. The returned set must never include the currently-accessedsessionId.- Parameters:
sessionId- the session being accessed- Returns:
- session IDs to evict; never
null, may be empty
-
onRemoved
Called after a session's tool index has been cleared — either because this strategy returned it fromonAccess(java.lang.String), or because of an explicit eviction request.Implementations should remove any internal tracking state for the evicted session.
- Parameters:
sessionId- the session that was evicted
-