pub struct EvictPolicy {
pub max_files: Option<usize>,
pub max_bytes: Option<u64>,
pub max_age: Option<Duration>,
}Expand description
Optional eviction controls applied by CacheGroup::ensure_dir_with_policy
and CacheRoot::ensure_group_with_policy.
Rules are enforced in this order:
max_age(remove files older than or equal to threshold)max_files(keep at most N files)max_bytes(keep total bytes at or below threshold)
For max_files and max_bytes, candidates are ordered by modified time
ascending (oldest first), then by path for deterministic tie-breaking.
Fields§
§max_files: Option<usize>Maximum number of files to keep under the managed directory tree.
If exceeded, the oldest files are removed first until the count is
<= max_files.
max_bytes: Option<u64>Maximum total size in bytes to keep under the managed directory tree.
If exceeded, files are removed oldest-first until total bytes are
<= max_bytes.
Notes:
- The limit applies to regular files recursively under the directory.
- Directories are not counted toward the byte total.
- Enforced only when using a policy-aware
ensure_*_with_policycall.
max_age: Option<Duration>Maximum file age allowed under the managed directory tree.
Files with age >= max_age are removed.
Trait Implementations§
Source§impl Clone for EvictPolicy
impl Clone for EvictPolicy
Source§fn clone(&self) -> EvictPolicy
fn clone(&self) -> EvictPolicy
Returns a duplicate of the value. Read more
1.0.0 · 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 EvictPolicy
impl Debug for EvictPolicy
Source§impl Default for EvictPolicy
impl Default for EvictPolicy
Source§fn default() -> EvictPolicy
fn default() -> EvictPolicy
Returns the “default value” for a type. Read more
Source§impl PartialEq for EvictPolicy
impl PartialEq for EvictPolicy
impl Eq for EvictPolicy
impl StructuralPartialEq for EvictPolicy
Auto Trait Implementations§
impl Freeze for EvictPolicy
impl RefUnwindSafe for EvictPolicy
impl Send for EvictPolicy
impl Sync for EvictPolicy
impl Unpin for EvictPolicy
impl UnsafeUnpin for EvictPolicy
impl UnwindSafe for EvictPolicy
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