pub struct ReputationCache { /* private fields */ }Expand description
In-memory cache for reputation data
Implementations§
Source§impl ReputationCache
impl ReputationCache
Sourcepub fn get_score(&self, user_id: Uuid) -> Option<ReputationScore>
pub fn get_score(&self, user_id: Uuid) -> Option<ReputationScore>
Get cached score for a user
Sourcepub fn set_score(
&self,
user_id: Uuid,
score: ReputationScore,
) -> Result<(), ReputationError>
pub fn set_score( &self, user_id: Uuid, score: ReputationScore, ) -> Result<(), ReputationError>
Cache a reputation score
Sourcepub fn invalidate_score(&self, user_id: Uuid)
pub fn invalidate_score(&self, user_id: Uuid)
Invalidate cached score for a user
Sourcepub fn get_tier(&self, user_id: Uuid) -> Option<(ReputationTier, Decimal)>
pub fn get_tier(&self, user_id: Uuid) -> Option<(ReputationTier, Decimal)>
Get cached tier for a user
Sourcepub fn set_tier(
&self,
user_id: Uuid,
tier: ReputationTier,
score: Decimal,
) -> Result<(), ReputationError>
pub fn set_tier( &self, user_id: Uuid, tier: ReputationTier, score: Decimal, ) -> Result<(), ReputationError>
Cache tier information
Sourcepub fn invalidate_tier(&self, user_id: Uuid)
pub fn invalidate_tier(&self, user_id: Uuid)
Invalidate cached tier for a user
Sourcepub fn invalidate_user(&self, user_id: Uuid)
pub fn invalidate_user(&self, user_id: Uuid)
Invalidate all cached data for a user
Sourcepub fn clear_scores(&self)
pub fn clear_scores(&self)
Clear all cached scores
Sourcepub fn clear_tiers(&self)
pub fn clear_tiers(&self)
Clear all cached tiers
Sourcepub fn cleanup_expired(&self) -> CacheCleanupStats
pub fn cleanup_expired(&self) -> CacheCleanupStats
Remove expired entries from cache
Sourcepub fn get_stats(&self) -> CacheStats
pub fn get_stats(&self) -> CacheStats
Get cache statistics
Sourcepub fn reset_metrics(&self)
pub fn reset_metrics(&self)
Reset cache metrics (hit/miss counters)
Trait Implementations§
Source§impl Clone for ReputationCache
impl Clone for ReputationCache
Source§fn clone(&self) -> ReputationCache
fn clone(&self) -> ReputationCache
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 ReputationCache
impl Debug for ReputationCache
Auto Trait Implementations§
impl Freeze for ReputationCache
impl RefUnwindSafe for ReputationCache
impl Send for ReputationCache
impl Sync for ReputationCache
impl Unpin for ReputationCache
impl UnwindSafe for ReputationCache
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