async_geotiff/io/cache.rs
1use std::time::Duration;
2
3/// Tuning for the decoded-block cache. `max_bytes` bounds total resident
4/// pixel memory across all cached blocks (moka evicts via TinyLFU). `ttl` is
5/// opt-in; COG data is immutable so the default relies on capacity eviction.
6#[derive(Clone, Copy, Debug)]
7pub struct CacheConfig {
8 /// Resident decoded-pixel byte capacity; defaults to 512 MiB.
9 /// Eviction is eventually consistent and does not account for caller-held
10 /// clones or decode working buffers. A zero capacity disables retention.
11 pub max_bytes: u64,
12 /// Optional lifetime of an inserted decoded block. Defaults to `None`,
13 /// relying on capacity eviction and immutable source identities.
14 pub ttl: Option<Duration>,
15}
16
17impl Default for CacheConfig {
18 fn default() -> Self {
19 Self {
20 max_bytes: 512 << 20,
21 ttl: None,
22 }
23 }
24}