pub trait CacheStore: Send + Sync {
// Required methods
fn get(
&self,
key: &str,
) -> DataFuture<'_, Result<Option<String>, DataError>>;
fn set(
&self,
key: &str,
value: &str,
ttl_seconds: Option<u64>,
) -> DataFuture<'_, Result<(), DataError>>;
fn delete(&self, key: &str) -> DataFuture<'_, Result<(), DataError>>;
}Expand description
CacheStore Trait
A trait for implementing cache storage backends. Provides key-value caching operations with optional TTL.
§Methods
get: Retrieves a value by keyset: Stores a value with optional expirationdelete: Removes a value by key
Required Methods§
Sourcefn get(&self, key: &str) -> DataFuture<'_, Result<Option<String>, DataError>>
fn get(&self, key: &str) -> DataFuture<'_, Result<Option<String>, DataError>>
Retrieves a cached value by key.
Returns None if the key doesn’t exist or has expired.