Skip to main content

Module cache

Module cache 

Source
Expand description

Cache Management and Download Progress

Manages the local model cache with cleanup, statistics, and download progress.

§Features

  • Cache size tracking and limits
  • LRU eviction for space management
  • Download progress callbacks
  • Cache statistics and health

§Example

use pacha::cache::{CacheManager, CacheConfig};

let config = CacheConfig::new()
    .with_max_size_gb(50.0)
    .with_auto_cleanup(true);

let cache = CacheManager::new(config, registry);

// Clean up old models
let freed = cache.cleanup()?;
println!("Freed {} bytes", freed);

Structs§

CacheConfig
Cache configuration
CacheEntry
A cached model entry
CacheManager
Cache manager for model storage
CacheStats
Cache statistics
DownloadProgress
Download progress information

Enums§

EvictionPolicy
Eviction policy for cache cleanup

Functions§

format_bytes
Format bytes as human-readable string
format_bytes_per_sec
Format bytes per second as human-readable string
format_duration
Format duration as human-readable string

Type Aliases§

ProgressCallback
Progress callback type