pub struct Cache { /* private fields */ }Expand description
Input-based cache for task outputs.
Implementations§
Source§impl Cache
impl Cache
Sourcepub fn compute_input_hash(
&self,
command: &str,
project_root: &Path,
input_patterns: &[String],
dependency_hashes: &[String],
) -> Result<String, CacheError>
pub fn compute_input_hash( &self, command: &str, project_root: &Path, input_patterns: &[String], dependency_hashes: &[String], ) -> Result<String, CacheError>
Compute the input hash for a task.
The hash is computed from:
- The target command
- Sorted input file contents (matched by glob patterns)
- Dependency cache keys (for transitivity)
Sourcepub fn check(
&mut self,
task_id: &TaskId,
current_hash: &str,
) -> Option<CacheEntry>
pub fn check( &mut self, task_id: &TaskId, current_hash: &str, ) -> Option<CacheEntry>
Check if a task has a valid cache entry.
Returns Some(entry) if the cache is valid, None otherwise.
Sourcepub fn write(
&self,
task_id: &TaskId,
input_hash: String,
success: bool,
command: String,
) -> Result<(), CacheError>
pub fn write( &self, task_id: &TaskId, input_hash: String, success: bool, command: String, ) -> Result<(), CacheError>
Write a cache entry for a task.
Sourcepub fn stats(&self) -> Result<CacheStats, CacheError>
pub fn stats(&self) -> Result<CacheStats, CacheError>
Get cache statistics.
Sourcepub fn clean(&self) -> Result<usize, CacheError>
pub fn clean(&self) -> Result<usize, CacheError>
Clean the cache directory.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnsafeUnpin for Cache
impl UnwindSafe for Cache
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