pub struct RedisBackend<C>where
C: RedisConn,{ /* private fields */ }Expand description
L1 hot cache: content-addressed key → value, sub-ms hits, TTL/eviction-aware.
Generic over the RedisConn seam so it is fully testable against a mock.
Implementations§
Source§impl<C> RedisBackend<C>where
C: RedisConn,
impl<C> RedisBackend<C>where
C: RedisConn,
Sourcepub fn new(conn: C) -> RedisBackend<C>
pub fn new(conn: C) -> RedisBackend<C>
Wrap a RedisConn with no per-write TTL (entries are LRU-evicted by
the maxmemory band).
Sourcepub fn with_ttl(conn: C, ttl_secs: u64) -> RedisBackend<C>
pub fn with_ttl(conn: C, ttl_secs: u64) -> RedisBackend<C>
Wrap a RedisConn, stamping every write with a ttl_secs expiry.
Trait Implementations§
Source§impl<C> StorageBackend for RedisBackend<C>where
C: RedisConn,
impl<C> StorageBackend for RedisBackend<C>where
C: RedisConn,
Source§fn wipe_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RedisBackend<C>: 'async_trait,
fn wipe_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RedisBackend<C>: 'async_trait,
Complete L1 wipe: DEL every key under BOTH the narinfo and NAR prefixes
(a scoped clear — never FLUSHDB, which would blow away an unrelated
co-tenant of the same Redis db). Returns the narinfo key count removed.
Source§fn get_narinfo<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RedisBackend<C>: 'async_trait,
fn get_narinfo<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RedisBackend<C>: 'async_trait,
Retrieve narinfo text by store path hash.
Source§fn put_narinfo<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
hash: &'life1 str,
content: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
RedisBackend<C>: 'async_trait,
fn put_narinfo<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
hash: &'life1 str,
content: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
RedisBackend<C>: 'async_trait,
Store narinfo text keyed by store path hash.
Source§fn get_nar<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RedisBackend<C>: 'async_trait,
fn get_nar<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RedisBackend<C>: 'async_trait,
Retrieve a NAR blob by its relative path.
Source§fn put_nar<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
RedisBackend<C>: 'async_trait,
fn put_nar<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 str,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
RedisBackend<C>: 'async_trait,
Store a NAR blob at the given relative path.
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RedisBackend<C>: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RedisBackend<C>: 'async_trait,
Delete a store path’s narinfo and associated NAR blob.
Source§fn list_narinfos<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RedisBackend<C>: 'async_trait,
fn list_narinfos<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
RedisBackend<C>: 'async_trait,
List all stored narinfo hashes.
Auto Trait Implementations§
impl<C> Freeze for RedisBackend<C>where
C: Freeze,
impl<C> RefUnwindSafe for RedisBackend<C>where
C: RefUnwindSafe,
impl<C> Send for RedisBackend<C>
impl<C> Sync for RedisBackend<C>
impl<C> Unpin for RedisBackend<C>where
C: Unpin,
impl<C> UnsafeUnpin for RedisBackend<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for RedisBackend<C>where
C: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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