pub struct DiskCache { /* private fields */ }Implementations§
Source§impl DiskCache
impl DiskCache
Sourcepub fn discover() -> Option<DiskCache>
pub fn discover() -> Option<DiskCache>
$SVA_CACHE, else the XDG cache home. Never under target/: cargo clean would throw
away hours of rendering, and an installed binary has no build directory to write into.
Sourcepub fn under(root: impl Into<PathBuf>) -> DiskCache
pub fn under(root: impl Into<PathBuf>) -> DiskCache
A key hashes what a node says, not the engine rendering it, so each engine keeps its own
directory under root; no other one’s can answer it, so they go.
pub fn at(dir: impl Into<PathBuf>) -> DiskCache
pub fn bounded(dir: impl Into<PathBuf>, max_bytes: u64) -> DiskCache
pub fn coded(self, codec: Box<dyn SampleCodec>) -> DiskCache
Sourcepub fn storing_everything(self) -> DiskCache
pub fn storing_everything(self) -> DiskCache
The threshold is policy: a caller measuring reuse itself wants every node stored.
Trait Implementations§
Source§impl Cache for DiskCache
impl Cache for DiskCache
Source§fn worth_storing(&self, cost: Duration, bytes: usize, kind: PayloadKind) -> bool
fn worth_storing(&self, cost: Duration, bytes: usize, kind: PayloadKind) -> bool
Only samples have an encoding here; neither other payload is offered a file.
Source§fn store(
&self,
key: Hash,
payload: &Payload,
traces: &[FilterTrace],
label: Option<&Label>,
)
fn store( &self, key: Hash, payload: &Payload, traces: &[FilterTrace], label: Option<&Label>, )
Renamed into place: a racing reader sees one whole entry or the other.
fn dir(&self) -> Option<&Path>
fn max_bytes(&self) -> u64
fn held_bytes(&self) -> u64
fn evicted_bytes(&self) -> u64
fn faults(&self) -> u64
fn holds(&self, key: Hash) -> bool
fn load(&self, key: Hash, node: &str, expected: Expected) -> Option<Entry>
Source§fn peek(&self, key: Hash, node: &str, expected: Expected) -> Option<Entry>
fn peek(&self, key: Hash, node: &str, expected: Expected) -> Option<Entry>
load with no side effect: no recency, promotion, fault or removal.fn sweep(&self)
Auto Trait Implementations§
impl !Freeze for DiskCache
impl !RefUnwindSafe for DiskCache
impl !Send for DiskCache
impl !UnwindSafe for DiskCache
impl Sync for DiskCache
impl Unpin for DiskCache
impl UnsafeUnpin for DiskCache
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