Struct actix_storage_dashmap::DashMapStore
source · pub struct DashMapStore { /* private fields */ }
Expand description
A simple implementation of Store
based on DashMap
This provider doesn’t support key expiration thus Storage will return errors when trying to use methods that require expiration functionality if there is no expiry provided.
Example
use actix_storage::Storage;
use actix_storage_dashmap::DashMapStore;
use actix_web::{App, HttpServer};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let storage = Storage::build().store(DashMapStore::new()).finish();
let server = HttpServer::new(move || {
App::new()
.data(storage.clone())
});
server.bind("localhost:5000")?.run().await
}
Implementations§
source§impl DashMapStore
impl DashMapStore
Trait Implementations§
source§impl Debug for DashMapStore
impl Debug for DashMapStore
source§impl Default for DashMapStore
impl Default for DashMapStore
source§fn default() -> DashMapStore
fn default() -> DashMapStore
Returns the “default value” for a type. Read more
source§impl Store for DashMapStore
impl Store for DashMapStore
source§fn set<'life0, 'async_trait>(
&'life0 self,
scope: Arc<[u8]>,
key: Arc<[u8]>,
value: Arc<[u8]>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set<'life0, 'async_trait>(
&'life0 self,
scope: Arc<[u8]>,
key: Arc<[u8]>,
value: Arc<[u8]>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set a key-value pair, if the key already exist, value should be overwritten
source§fn get<'life0, 'async_trait>(
&'life0 self,
scope: Arc<[u8]>,
key: Arc<[u8]>
) -> Pin<Box<dyn Future<Output = Result<Option<Arc<[u8]>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 self,
scope: Arc<[u8]>,
key: Arc<[u8]>
) -> Pin<Box<dyn Future<Output = Result<Option<Arc<[u8]>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get a value for specified key, it should result in None if the value does not exist