pub struct CacheGroup { /* private fields */ }Expand description
A group (subdirectory) under a CacheRoot that manages cache entries.
Use CacheRoot::group(...) to construct a CacheGroup rooted under a
CacheRoot.
Implementations§
Source§impl CacheGroup
impl CacheGroup
Sourcepub fn ensure_dir(&self) -> Result<&Path>
pub fn ensure_dir(&self) -> Result<&Path>
Ensure the group directory exists on disk, creating parents as needed.
Sourcepub fn ensure_dir_with_policy(
&self,
policy: Option<&EvictPolicy>,
) -> Result<&Path>
pub fn ensure_dir_with_policy( &self, policy: Option<&EvictPolicy>, ) -> Result<&Path>
Ensures this directory exists, then applies optional eviction.
Eviction is applied recursively to files under this directory. The policy is best-effort for removals: individual delete failures are ignored so initialization can continue.
Sourcepub fn eviction_report(&self, policy: &EvictPolicy) -> Result<EvictionReport>
pub fn eviction_report(&self, policy: &EvictPolicy) -> Result<EvictionReport>
Returns a report of files that would be evicted under policy.
This does not delete files. The selection order matches the internal
order used by ensure_dir_with_policy.
Return a report of files that would be evicted by policy.
The report is non-destructive and mirrors the selection used by
ensure_dir_with_policy so it can be used for previewing or testing.
Sourcepub fn subgroup<P: AsRef<Path>>(&self, relative_group: P) -> Self
pub fn subgroup<P: AsRef<Path>>(&self, relative_group: P) -> Self
Create a nested subgroup under this group.
Sourcepub fn entry_path<P: AsRef<Path>>(&self, relative_file: P) -> PathBuf
pub fn entry_path<P: AsRef<Path>>(&self, relative_file: P) -> PathBuf
Resolve a relative entry path under this group.
Trait Implementations§
Source§impl Clone for CacheGroup
impl Clone for CacheGroup
Source§fn clone(&self) -> CacheGroup
fn clone(&self) -> CacheGroup
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more