v3.9.0 Codeberg

Reference

Constructor

pub fn builder() -> StoreBuilder

Creates a store. Options are described on the configuration page; anything left unset uses its default.

set

pub async fn set(&self, key: &str, value: &[u8]) -> Result<(), Error>

Stores a value under the key using the default TTL.

get

pub async fn get(&self, key: &str) -> Result<Option<Vec<u8>>, Error>

Returns the value for the key, or nothing if it is missing or expired.

delete

pub async fn delete(&self, key: &str) -> Result<bool, Error>

Removes the key and reports whether it was present.

len

pub async fn len(&self) -> Result<u64, Error>

Returns the number of live entries.

clear

pub async fn clear(&self) -> Result<(), Error>

Removes every entry and resets the counters.