pub struct DocFormatCache { /* private fields */ }Expand description
Resolved formats, keyed by (tn_id, content_type).
A per-App extension rather than a static, so two Apps in one process —
integration tests, embedded or multi-instance hosting — cannot contradict each
other’s tenant rows. Keyed per tenant because the tenant’s own doc_formats
row wins over the bundle. Invalidated by invalidate on every write through
put_doc_format/delete_doc_format.
resolve sits on two hot paths: one read per distinct content type in a
search result page (on the anonymous search route), and one read per document
during an index sweep. None is cached too — a content type governed by no
format is the common answer, and exactly the one that costs the round trip.
parking_lot::Mutex rather than an RwLock, as in
crate::dir_cache::DirCache: an LRU read promotes its entry, so even a
lookup needs exclusive access. content_type comes from
files.content_type and is caller-influenced, so an unbounded negative cache
would be a memory-growth vector; eviction bounds it without throwing away the
hot working set the way a clear-on-full cap would.
Implementations§
Trait Implementations§
Source§impl Clone for DocFormatCache
impl Clone for DocFormatCache
Source§fn clone(&self) -> DocFormatCache
fn clone(&self) -> DocFormatCache
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for DocFormatCache
impl !UnwindSafe for DocFormatCache
impl Freeze for DocFormatCache
impl Send for DocFormatCache
impl Sync for DocFormatCache
impl Unpin for DocFormatCache
impl UnsafeUnpin for DocFormatCache
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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