pub struct Cache { /* private fields */ }Expand description
Multi-level cache for different data types
Implementations§
Source§impl Cache
impl Cache
Sourcepub fn new(config: CacheConfig) -> Self
pub fn new(config: CacheConfig) -> Self
Create a new cache with the given configuration
Sourcepub fn get_workflow(&self, id: &Uuid) -> Option<WorkflowRow>
pub fn get_workflow(&self, id: &Uuid) -> Option<WorkflowRow>
Get workflow from cache
Sourcepub fn put_workflow(&self, id: Uuid, workflow: WorkflowRow)
pub fn put_workflow(&self, id: Uuid, workflow: WorkflowRow)
Put workflow into cache
Sourcepub fn invalidate_workflow(&self, id: &Uuid)
pub fn invalidate_workflow(&self, id: &Uuid)
Invalidate workflow cache entry
Sourcepub fn get_user_quota(&self, user_id: &Uuid) -> Option<UserQuota>
pub fn get_user_quota(&self, user_id: &Uuid) -> Option<UserQuota>
Get user quota from cache
Sourcepub fn put_user_quota(&self, user_id: Uuid, quota: UserQuota)
pub fn put_user_quota(&self, user_id: Uuid, quota: UserQuota)
Put user quota into cache
Sourcepub fn invalidate_user_quota(&self, user_id: &Uuid)
pub fn invalidate_user_quota(&self, user_id: &Uuid)
Invalidate user quota cache entry
Sourcepub fn get_workflow_quota(&self, workflow_id: &Uuid) -> Option<WorkflowQuota>
pub fn get_workflow_quota(&self, workflow_id: &Uuid) -> Option<WorkflowQuota>
Get workflow quota from cache
Sourcepub fn put_workflow_quota(&self, workflow_id: Uuid, quota: WorkflowQuota)
pub fn put_workflow_quota(&self, workflow_id: Uuid, quota: WorkflowQuota)
Put workflow quota into cache
Sourcepub fn invalidate_workflow_quota(&self, workflow_id: &Uuid)
pub fn invalidate_workflow_quota(&self, workflow_id: &Uuid)
Invalidate workflow quota cache entry
Sourcepub fn put_api_key(&self, key_hash: String, encrypted_key: Vec<u8>)
pub fn put_api_key(&self, key_hash: String, encrypted_key: Vec<u8>)
Put API key into cache
Sourcepub fn invalidate_api_key(&self, key_hash: &str)
pub fn invalidate_api_key(&self, key_hash: &str)
Invalidate API key cache entry
Sourcepub fn evict_expired(&self)
pub fn evict_expired(&self)
Evict expired entries from all caches
Sourcepub fn stats(&self) -> HashMap<String, CacheStats>
pub fn stats(&self) -> HashMap<String, CacheStats>
Get cache statistics
Sourcepub fn metrics(&self) -> CacheMetrics
pub fn metrics(&self) -> CacheMetrics
Get cache metrics
Sourcepub fn reset_metrics(&self)
pub fn reset_metrics(&self)
Reset cache metrics
Sourcepub fn export_metrics(&self) -> HashMap<String, f64>
pub fn export_metrics(&self) -> HashMap<String, f64>
Export metrics in a format suitable for monitoring systems
Auto Trait Implementations§
impl Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
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> 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