Expand description
This module provides the core logic for cache pruning operations, allowing users to reclaim disk space by removing old or excessive entries.
§Features
- Time-based retention: Remove entries older than N days
- Size-based retention: Cap cache to maximum size (oldest-first eviction)
- Dry-run mode: Preview deletions without modifying cache
- Detailed reporting: Summary of removed/remaining entries and bytes
§Usage
ⓘ
use sqry_core::cache::{CacheManager, PruneOptions};
use std::time::Duration;
let cache = CacheManager::default();
let options = PruneOptions::new()
.with_max_age(Duration::from_secs(7 * 24 * 3600)) // 7 days
.with_dry_run(true);
let report = cache.prune(&options)?;
println!("Would remove {} entries ({} bytes)",
report.entries_removed, report.bytes_removed);Structs§
- Prune
Engine - Engine for performing cache prune operations.
- Prune
Operation - Details of a single prune operation.
- Prune
Options - Options for cache pruning operations.
- Prune
Report - Report summarizing a prune operation.
Enums§
- Prune
Output Mode - Output format for prune results.
- Prune
Reason - Reason why an entry was pruned.