pub struct CacheRadiusTracker { /* private fields */ }Expand description
Per-location TTL store of the walk’s cache radius.
The cache radius is the minimum LeadingAgreementBits of all servers that returned data
during the previous walk. It represents how far out caching has propagated: all servers
with LAB ≥ radius are likely to already hold cached data, so future walks can try a little further out, thereby alleviating load.
Implementations§
Source§impl CacheRadiusTracker
impl CacheRadiusTracker
pub fn new(ttl: DurationMillis) -> Self
Sourcepub fn get(
&self,
location_id: Id,
now: TimeMillis,
) -> Option<LeadingAgreementBits>
pub fn get( &self, location_id: Id, now: TimeMillis, ) -> Option<LeadingAgreementBits>
Returns the cached radius if it has not expired.
Sourcepub fn update(
&self,
location_id: Id,
radius: LeadingAgreementBits,
now: TimeMillis,
)
pub fn update( &self, location_id: Id, radius: LeadingAgreementBits, now: TimeMillis, )
Replaces the stored radius unconditionally (each walk produces a fresh observation).
Auto Trait Implementations§
impl !Freeze for CacheRadiusTracker
impl !RefUnwindSafe for CacheRadiusTracker
impl Send for CacheRadiusTracker
impl Sync for CacheRadiusTracker
impl Unpin for CacheRadiusTracker
impl UnsafeUnpin for CacheRadiusTracker
impl UnwindSafe for CacheRadiusTracker
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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