pub enum EvictionStrategy {
PerItem,
Bulk {
overflow: usize,
},
Compact {
compact_count: usize,
},
}Expand description
Eviction strategy for SlidingWindow regions.
Controls how entries are removed when the window exceeds its max_items limit.
The choice of strategy affects prompt caching effectiveness: PerItem eviction
shifts the message prefix every iteration (breaking cache), while Bulk and
Compact keep the prefix stable between eviction events.
Variants§
PerItem
Evict one turn group at a time (current behavior). Default.
Bulk
Evict in bulk when items exceed max + overflow. Between bulk evictions, the prefix stays stable for caching.
Fields
Compact
Summarize oldest entries when threshold is hit (requires external LLM call).
The region stores a pending_compaction flag; the runtime checks this
and performs compaction externally.
Trait Implementations§
Source§impl Clone for EvictionStrategy
impl Clone for EvictionStrategy
Source§fn clone(&self) -> EvictionStrategy
fn clone(&self) -> EvictionStrategy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EvictionStrategy
impl Debug for EvictionStrategy
Source§impl Default for EvictionStrategy
impl Default for EvictionStrategy
Source§fn default() -> EvictionStrategy
fn default() -> EvictionStrategy
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for EvictionStrategy
impl<'de> Deserialize<'de> for EvictionStrategy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for EvictionStrategy
Source§impl PartialEq for EvictionStrategy
impl PartialEq for EvictionStrategy
Source§impl Serialize for EvictionStrategy
impl Serialize for EvictionStrategy
impl StructuralPartialEq for EvictionStrategy
Auto Trait Implementations§
impl Freeze for EvictionStrategy
impl RefUnwindSafe for EvictionStrategy
impl Send for EvictionStrategy
impl Sync for EvictionStrategy
impl Unpin for EvictionStrategy
impl UnsafeUnpin for EvictionStrategy
impl UnwindSafe for EvictionStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.