pub struct RedisMemoryProfile {
pub used_bytes: u64,
pub max_bytes: u64,
pub last_updated: Instant,
pub pending_writes_estimate: u64,
}Expand description
Cached Redis memory profile to avoid round-trips.
Fields§
§used_bytes: u64Used memory in bytes (from INFO MEMORY)
max_bytes: u64Max memory in bytes (from CONFIG GET maxmemory)
last_updated: InstantWhen we last refreshed from Redis
pending_writes_estimate: u64Estimated bytes written since last refresh
Implementations§
Source§impl RedisMemoryProfile
impl RedisMemoryProfile
Sourcepub fn needs_refresh(
&self,
max_staleness: Duration,
max_drift_bytes: u64,
) -> bool
pub fn needs_refresh( &self, max_staleness: Duration, max_drift_bytes: u64, ) -> bool
Whether we need to refresh from Redis
Sourcepub fn add_pending_writes(&mut self, bytes: u64)
pub fn add_pending_writes(&mut self, bytes: u64)
Add pending writes estimate (call after batch write)
Sourcepub fn refresh_from_info(&mut self, used_bytes: u64, max_bytes: u64)
pub fn refresh_from_info(&mut self, used_bytes: u64, max_bytes: u64)
Refresh from Redis INFO output
Trait Implementations§
Source§impl Clone for RedisMemoryProfile
impl Clone for RedisMemoryProfile
Source§fn clone(&self) -> RedisMemoryProfile
fn clone(&self) -> RedisMemoryProfile
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RedisMemoryProfile
impl Debug for RedisMemoryProfile
Auto Trait Implementations§
impl Freeze for RedisMemoryProfile
impl RefUnwindSafe for RedisMemoryProfile
impl Send for RedisMemoryProfile
impl Sync for RedisMemoryProfile
impl Unpin for RedisMemoryProfile
impl UnwindSafe for RedisMemoryProfile
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> 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>
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