pub struct CacheManager { /* private fields */ }Expand description
Advanced cache manager with fine-grained invalidation.
Implementations§
Source§impl CacheManager
impl CacheManager
Sourcepub fn new(metrics: Arc<RoleSystemMetrics>) -> Self
pub fn new(metrics: Arc<RoleSystemMetrics>) -> Self
Create a new cache manager.
Sourcepub fn insert(
&self,
key: (String, String),
permissions: UserPermissions,
tags: HashSet<CacheTag>,
)
pub fn insert( &self, key: (String, String), permissions: UserPermissions, tags: HashSet<CacheTag>, )
Insert a cache entry with tags.
Sourcepub fn get(
&self,
key: &(String, String),
ttl_seconds: u64,
) -> Option<UserPermissions>
pub fn get( &self, key: &(String, String), ttl_seconds: u64, ) -> Option<UserPermissions>
Get a cache entry if it exists and is valid.
Sourcepub fn invalidate_by_tag(&self, tag: &CacheTag)
pub fn invalidate_by_tag(&self, tag: &CacheTag)
Invalidate cache entries by tag.
Sourcepub fn invalidate_subject(&self, subject_id: &str)
pub fn invalidate_subject(&self, subject_id: &str)
Invalidate cache entries for a specific subject.
Sourcepub fn invalidate_role(&self, role_name: &str)
pub fn invalidate_role(&self, role_name: &str)
Invalidate cache entries involving a specific role.
Sourcepub fn invalidate_resource_type(&self, resource_type: &str)
pub fn invalidate_resource_type(&self, resource_type: &str)
Invalidate cache entries for a specific resource type.
Sourcepub fn invalidate_context_dependent(&self)
pub fn invalidate_context_dependent(&self)
Invalidate all context-dependent cache entries.
Sourcepub fn cleanup_expired(&self, ttl_seconds: u64)
pub fn cleanup_expired(&self, ttl_seconds: u64)
Remove expired entries.
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics.
Generate cache tags for a permission check.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CacheManager
impl !RefUnwindSafe for CacheManager
impl Send for CacheManager
impl Sync for CacheManager
impl Unpin for CacheManager
impl !UnwindSafe for CacheManager
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