pub struct WorkspaceCache { /* private fields */ }Implementations§
Source§impl WorkspaceCache
impl WorkspaceCache
Sourcepub fn new(
roots: &[PathBuf],
debounce_ms: u32,
max_age_seconds: u32,
) -> Result<Arc<Self>>
pub fn new( roots: &[PathBuf], debounce_ms: u32, max_age_seconds: u32, ) -> Result<Arc<Self>>
Build a cache for the given workspace roots. Each root is
watched recursively; any *.md change invalidates every entry
keyed under that root.
debounce_ms: coalesces bursts (saves from editors that write +
rename + chmod). 500ms is a reasonable default.
max_age_seconds: force a refresh after this many seconds even
without a watch event. 0 = disabled.
Sourcepub fn invalidate_root(&self, root: &Path)
pub fn invalidate_root(&self, root: &Path)
Invalidate every entry under the given workspace root. Idempotent.
Sourcepub fn metrics(&self) -> Arc<WorkspaceCacheMetrics> ⓘ
pub fn metrics(&self) -> Arc<WorkspaceCacheMetrics> ⓘ
Return the metrics handle (counters per workspace root).
Sourcepub async fn get(
&self,
root: &Path,
scope: SessionScope,
extras: &[String],
) -> Result<Arc<WorkspaceBundle>>
pub async fn get( &self, root: &Path, scope: SessionScope, extras: &[String], ) -> Result<Arc<WorkspaceBundle>>
Get (or build) the bundle for (root, scope, extras). Falls
back to a fresh WorkspaceLoader on miss; subsequent calls hit
the cache until invalidated.
Auto Trait Implementations§
impl !Freeze for WorkspaceCache
impl !RefUnwindSafe for WorkspaceCache
impl !UnwindSafe for WorkspaceCache
impl Send for WorkspaceCache
impl Sync for WorkspaceCache
impl Unpin for WorkspaceCache
impl UnsafeUnpin for WorkspaceCache
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more