pub struct Client { /* private fields */ }Expand description
KV Client.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn get<T: DeserializeOwned + Serialize>(&self, key: &str) -> Result<T>
pub async fn get<T: DeserializeOwned + Serialize>(&self, key: &str) -> Result<T>
Get value of a key.
Sourcepub fn clear_cached(&self)
pub fn clear_cached(&self)
Clear all cached values.
Sourcepub fn prune_cached(&self, key: &str)
pub fn prune_cached(&self, key: &str)
Delete a single key value from cache only.
Source§impl Client
impl Client
Sourcepub fn new<T: Into<String>, E: Into<String>>(
endpoint: E,
token: T,
timeout: Duration,
cache_size: usize,
expire_ttl: Duration,
) -> Result<Self, ClientError>
pub fn new<T: Into<String>, E: Into<String>>( endpoint: E, token: T, timeout: Duration, cache_size: usize, expire_ttl: Duration, ) -> Result<Self, ClientError>
Create client with endpoint and token. If cache is enabled, you may set cache size and ttl.
Sourcepub async fn put<T: Serialize + ?Sized>(
&self,
key: &str,
value: &T,
) -> Result<()>
pub async fn put<T: Serialize + ?Sized>( &self, key: &str, value: &T, ) -> Result<()>
Set a key value pair.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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