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
Auto Trait Implementations§
impl Freeze for DashMapStore
impl !RefUnwindSafe for DashMapStore
impl Send for DashMapStore
impl Sync for DashMapStore
impl Unpin for DashMapStore
impl UnwindSafe for DashMapStore
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