pub struct LockFileCache { /* private fields */ }Expand description
Cache for parsed lock files with automatic staleness detection.
Caches parsed lock file contents and checks file modification time to avoid re-parsing unchanged files. Thread-safe for concurrent access.
§Examples
use deps_core::lockfile::LockFileCache;
use std::path::Path;
let cache = LockFileCache::new();
// First call parses the file
// Second call returns cached result if file hasn't changedImplementations§
Source§impl LockFileCache
impl LockFileCache
Sourcepub async fn get_or_parse(
&self,
provider: &dyn LockFileProvider,
lockfile_path: &Path,
) -> Result<ResolvedPackages>
pub async fn get_or_parse( &self, provider: &dyn LockFileProvider, lockfile_path: &Path, ) -> Result<ResolvedPackages>
Gets parsed packages from cache or parses the lock file.
Checks file modification time to detect changes. If the file has been modified since last parse, re-parses it. Otherwise, returns the cached result.
§Arguments
provider- Lock file provider implementationlockfile_path- Path to the lock file
§Returns
Resolved packages on success
§Errors
Returns error if file cannot be read or parsed
Sourcepub fn invalidate(&self, lockfile_path: &Path)
pub fn invalidate(&self, lockfile_path: &Path)
Invalidates cached entry for a lock file.
Forces next access to re-parse the file. Use when you know the file has changed but modification time might not reflect it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LockFileCache
impl !RefUnwindSafe for LockFileCache
impl Send for LockFileCache
impl Sync for LockFileCache
impl Unpin for LockFileCache
impl UnwindSafe for LockFileCache
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