struct EntryCache {
snapshots: Vec<EntrySnapshot>,
}Expand description
Bounded cache of candidate sets from previous DB loads. Backspacing (or re-typing) a query restores a previous set by moving it out of the cache instead of re-scanning the table, which costs ~100ms at 500k rows.
Fields§
§snapshots: Vec<EntrySnapshot>Implementations§
Source§impl EntryCache
impl EntryCache
const CAP: usize = 8
Sourcefn covers(
db_query: Option<&RecallQuery>,
query: &RecallQuery,
wants_prefilter: bool,
) -> bool
fn covers( db_query: Option<&RecallQuery>, query: &RecallQuery, wants_prefilter: bool, ) -> bool
Whether a set loaded with db_query is guaranteed to contain every
row the DB would return for query. A narrow set covers queries
whose prefilter conditions imply its own (RecallQuery::covers, the
same relation the LIKE patterns are built from); the broad set covers
exactly the queries that don’t want a DB dig, since it is
window-limited.
Sourcefn take_covering(
&mut self,
query: &RecallQuery,
wants_prefilter: bool,
) -> Option<EntrySnapshot>
fn take_covering( &mut self, query: &RecallQuery, wants_prefilter: bool, ) -> Option<EntrySnapshot>
Remove and return the narrowest cached set covering query.
Narrowest = fewest entries for the fuzzy stage to re-rank.
Sourcefn store(&mut self, snap: EntrySnapshot)
fn store(&mut self, snap: EntrySnapshot)
Store a snapshot, replacing any existing one for the same db_query and evicting the oldest when full.
fn clear(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EntryCache
impl RefUnwindSafe for EntryCache
impl Send for EntryCache
impl Sync for EntryCache
impl Unpin for EntryCache
impl UnsafeUnpin for EntryCache
impl UnwindSafe for EntryCache
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
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