pub struct Cache { /* private fields */ }Expand description
Client for a running cache provider.
Implementations§
Source§impl Cache
impl Cache
Sourcepub async fn connect() -> Result<Self, CacheError>
pub async fn connect() -> Result<Self, CacheError>
Connects to the default cache transport socket.
Sourcepub async fn connect_named(name: &str) -> Result<Self, CacheError>
pub async fn connect_named(name: &str) -> Result<Self, CacheError>
Connects to a named cache transport socket.
Sourcepub async fn get(&mut self, key: &str) -> Result<Option<Vec<u8>>, CacheError>
pub async fn get(&mut self, key: &str) -> Result<Option<Vec<u8>>, CacheError>
Loads one cache value.
Sourcepub async fn get_many<S>(
&mut self,
keys: &[S],
) -> Result<BTreeMap<String, Vec<u8>>, CacheError>
pub async fn get_many<S>( &mut self, keys: &[S], ) -> Result<BTreeMap<String, Vec<u8>>, CacheError>
Loads all present values for keys.
Sourcepub async fn set(
&mut self,
key: &str,
value: &[u8],
options: CacheSetOptions,
) -> Result<(), CacheError>
pub async fn set( &mut self, key: &str, value: &[u8], options: CacheSetOptions, ) -> Result<(), CacheError>
Stores one cache value.
Sourcepub async fn set_many(
&mut self,
entries: &[CacheEntry],
options: CacheSetOptions,
) -> Result<(), CacheError>
pub async fn set_many( &mut self, entries: &[CacheEntry], options: CacheSetOptions, ) -> Result<(), CacheError>
Stores multiple cache values in one RPC.
Sourcepub async fn delete_many<S>(&mut self, keys: &[S]) -> Result<i64, CacheError>
pub async fn delete_many<S>(&mut self, keys: &[S]) -> Result<i64, CacheError>
Deletes many cache keys.
Auto Trait Implementations§
impl !Freeze for Cache
impl !RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnsafeUnpin for Cache
impl !UnwindSafe for Cache
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request