pub struct RedisStore { /* private fields */ }Implementations§
Source§impl RedisStore
impl RedisStore
Sourcepub async fn new(connection_string: &str) -> Result<Self, StorageError>
pub async fn new(connection_string: &str) -> Result<Self, StorageError>
Create a new Redis store without a key prefix.
Sourcepub async fn with_prefix(
connection_string: &str,
prefix: Option<&str>,
) -> Result<Self, StorageError>
pub async fn with_prefix( connection_string: &str, prefix: Option<&str>, ) -> Result<Self, StorageError>
Create a new Redis store with an optional key prefix.
The prefix is prepended to all keys, enabling namespacing when sharing a Redis instance with other applications.
§Example
// Keys will be prefixed: "myapp:user.alice", "myapp:config.app"
let store = RedisStore::with_prefix("redis://localhost", Some("myapp:")).await?;Sourcepub fn connection(&self) -> ConnectionManager
pub fn connection(&self) -> ConnectionManager
Get a clone of the connection manager (for sharing with MerkleStore)
Source§impl RedisStore
impl RedisStore
Sourcepub async fn exists_batch(
&self,
ids: &[String],
) -> Result<Vec<bool>, StorageError>
pub async fn exists_batch( &self, ids: &[String], ) -> Result<Vec<bool>, StorageError>
Check if multiple keys exist in Redis (pipelined). Returns a vec of bools matching the input order.
Trait Implementations§
Source§impl CacheStore for RedisStore
impl CacheStore for RedisStore
Source§fn put_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
items: &'life1 [SyncItem],
) -> Pin<Box<dyn Future<Output = Result<BatchWriteResult, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
items: &'life1 [SyncItem],
) -> Pin<Box<dyn Future<Output = Result<BatchWriteResult, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Write a batch of items using Redis pipeline (atomic, much faster than individual SETs).
Source§fn put_batch_with_ttl<'life0, 'life1, 'async_trait>(
&'life0 self,
items: &'life1 [SyncItem],
ttl_secs: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<BatchWriteResult, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put_batch_with_ttl<'life0, 'life1, 'async_trait>(
&'life0 self,
items: &'life1 [SyncItem],
ttl_secs: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<BatchWriteResult, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Write a batch of items with optional TTL.
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SyncItem>, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
item: &'life1 SyncItem,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if an item exists (Redis EXISTS command - fast, no data transfer).
Auto Trait Implementations§
impl Freeze for RedisStore
impl !RefUnwindSafe for RedisStore
impl Send for RedisStore
impl Sync for RedisStore
impl Unpin for RedisStore
impl !UnwindSafe for RedisStore
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