pub trait KvStore:
Send
+ Sync
+ 'static {
// Required methods
fn get<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Option<Bytes>>;
fn set<'a>(
&'a self,
key: &'a str,
val: Bytes,
ttl: Option<Duration>,
) -> BoxFuture<'a, ()>;
fn remove<'a>(&'a self, key: &'a str) -> BoxFuture<'a, ()>;
fn incr<'a>(
&'a self,
key: &'a str,
by: i64,
ttl: Option<Duration>,
) -> BoxFuture<'a, u64>;
fn clear_prefix<'a>(&'a self, prefix: &'a str) -> BoxFuture<'a, u64>;
}Required Methods§
fn get<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Option<Bytes>>
fn set<'a>( &'a self, key: &'a str, val: Bytes, ttl: Option<Duration>, ) -> BoxFuture<'a, ()>
fn remove<'a>(&'a self, key: &'a str) -> BoxFuture<'a, ()>
Sourcefn incr<'a>(
&'a self,
key: &'a str,
by: i64,
ttl: Option<Duration>,
) -> BoxFuture<'a, u64>
fn incr<'a>( &'a self, key: &'a str, by: i64, ttl: Option<Duration>, ) -> BoxFuture<'a, u64>
Atomic increment; creates the key at by when missing. Returns new value.
Sourcefn clear_prefix<'a>(&'a self, prefix: &'a str) -> BoxFuture<'a, u64>
fn clear_prefix<'a>(&'a self, prefix: &'a str) -> BoxFuture<'a, u64>
Remove keys starting with prefix. Returns how many were removed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".