pub struct AsyncRedisCacheBuilder<K, V> { /* private fields */ }async and crate feature redis_store and (crate features redis_async_std or redis_tokio) only.Implementations§
source§impl<K, V> AsyncRedisCacheBuilder<K, V>
impl<K, V> AsyncRedisCacheBuilder<K, V>
sourcepub fn new<S: ToString>(
prefix: S,
seconds: Option<u64>,
) -> AsyncRedisCacheBuilder<K, V>
pub fn new<S: ToString>( prefix: S, seconds: Option<u64>, ) -> AsyncRedisCacheBuilder<K, V>
Initialize a RedisCacheBuilder
sourcepub fn set_namespace<S: ToString>(self, namespace: S) -> Self
pub fn set_namespace<S: ToString>(self, namespace: S) -> Self
Set the namespace for cache keys. Defaults to kash-redis-store:.
Used to generate keys formatted as: {namespace}{prefix}{key}
Note that no delimiters are implicitly added, so you may pass
an empty string if you want there to be no namespace on keys.
sourcepub fn set_prefix<S: ToString>(self, prefix: S) -> Self
pub fn set_prefix<S: ToString>(self, prefix: S) -> Self
Set the prefix for cache keys
Used to generate keys formatted as: {namespace}{prefix}{key}
Note that no delimiters are implicitly added, so you may pass
an empty string if you want there to be no prefix on keys.
sourcepub fn set_connection_string(self, cs: &str) -> Self
pub fn set_connection_string(self, cs: &str) -> Self
Set the connection string for redis
sourcepub fn connection_string(&self) -> Result<String, RedisCacheBuildError>
pub fn connection_string(&self) -> Result<String, RedisCacheBuildError>
Return the current connection string or load from the env var: KASH_REDIS_CONNECTION_STRING
§Errors
Will return RedisCacheBuildError::MissingConnectionString if connection string is not set
sourcepub async fn build(self) -> Result<AsyncRedisCache<K, V>, RedisCacheBuildError>
pub async fn build(self) -> Result<AsyncRedisCache<K, V>, RedisCacheBuildError>
The last step in building a RedisCache is to call build()
§Errors
Will return a RedisCacheBuildError, depending on the error