Skip to main content

Module prune

Module prune 

Source
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§

PruneEngine
Engine for performing cache prune operations.
PruneOperation
Details of a single prune operation.
PruneOptions
Options for cache pruning operations.
PruneReport
Report summarizing a prune operation.

Enums§

PruneOutputMode
Output format for prune results.
PruneReason
Reason why an entry was pruned.