pub struct RedisPolicyStore { /* private fields */ }Expand description
Redis-backed read-through PolicyStore.
get_policy reads a JSON PolicyDocument from
aa:policy:<agent_id> and returns
NotFound on a cache miss — callers
fall through to the authoritative store and then repopulate the cache with
cache_policy.
invalidate deletes the cached key. Cheap to
Clone — clones share the underlying Pool.
Implementations§
Source§impl RedisPolicyStore
impl RedisPolicyStore
Sourcepub async fn cache_policy(
&self,
agent_id: &AgentId,
policy: &PolicyDocument,
ttl_secs: u64,
) -> Result<()>
pub async fn cache_policy( &self, agent_id: &AgentId, policy: &PolicyDocument, ttl_secs: u64, ) -> Result<()>
Populate the cache for agent_id with policy, expiring after
ttl_secs seconds (SET ... EX).
This is the write half of the read-through cache: callers invoke it
after loading a policy from the authoritative store on a
get_policy miss. See
DEFAULT_POLICY_CACHE_TTL_SECS for the suggested default TTL.
Trait Implementations§
Source§impl Clone for RedisPolicyStore
impl Clone for RedisPolicyStore
Source§fn clone(&self) -> RedisPolicyStore
fn clone(&self) -> RedisPolicyStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl PolicyStore for RedisPolicyStore
impl PolicyStore for RedisPolicyStore
Source§fn get_policy<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: &'life1 AgentId,
) -> Pin<Box<dyn Future<Output = Result<PolicyDocument>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_policy<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: &'life1 AgentId,
) -> Pin<Box<dyn Future<Output = Result<PolicyDocument>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return the effective policy for
agent_id. Read moreSource§fn invalidate<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: &'life1 AgentId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn invalidate<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: &'life1 AgentId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Drop any cached policy for
agent_id so the next read reloads it. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for RedisPolicyStore
impl !UnwindSafe for RedisPolicyStore
impl Freeze for RedisPolicyStore
impl Send for RedisPolicyStore
impl Sync for RedisPolicyStore
impl Unpin for RedisPolicyStore
impl UnsafeUnpin for RedisPolicyStore
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