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§

Make a new store, with default capacity of 0

Make a new store, with specified capacity

Make a new store from a hashmap

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Set a key-value pair, if the key already exist, value should be overwritten
Get a value for specified key, it should result in None if the value does not exist
Delete the key from storage, if the key doesn’t exist, it shouldn’t return an error
Check if key exist in storage

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more