[−][src]Struct actix_storage_hashmap::HashMapActor
An implementation of ExpiryStore
based on async
actix actors and HashMap
It relies on tokio's DelayQueue internally to manage expiration, and it doesn't have any lock as it runs in single threaded async arbiter.
Example
use actix_storage::Storage; use actix_storage_hashmap::HashMapActor; use actix_web::{App, HttpServer}; #[actix_web::main] async fn main() -> std::io::Result<()> { let store = HashMapActor::start_default(); // OR let store = HashMapActor::with_capacity(100).start(); let storage = Storage::build().expiry_store(store).finish(); let server = HttpServer::new(move || { App::new() .data(storage.clone()) }); server.bind("localhost:5000")?.run().await }
requires ["actor"] feature
Implementations
impl HashMapActor
[src]
#[must_use = "Actor should be started to work by calling `start`"]pub fn new() -> Self
[src]
Makes a new HashMapActor without starting it
#[must_use = "Actor should be started to work by calling `start`"]pub fn with_capacity(capacity: usize) -> Self
[src]
Makes a new HashMapActor with specified HashMap capacity without starting it
#[must_use = "Actor should be started to work by calling `start`"]pub fn with_capacity_and_channel_size(
capacity: usize,
input_buffer: usize,
output_buffer: usize
) -> Self
[src]
capacity: usize,
input_buffer: usize,
output_buffer: usize
) -> Self
Makes a new HashMapActor with specified HashMap and channel capacity without starting it
Buffer sizes are used for internal expiry channel provider, input is for the channel providing commands expire/extend/expiry/persist and output is the other channel that sends back expired items.
pub fn start(self) -> Addr<Self>
[src]
Equivalent of actix::Actor::start for when actix::Actor is not in scope
pub fn start_default() -> Addr<Self>
[src]
Equivalent of actix::Actor::start_default for when actix::Actor is not in scope
Trait Implementations
impl Actor for HashMapActor
[src]
type Context = Context<Self>
Actor execution context type
fn started(&mut self, ctx: &mut Self::Context)
[src]
fn stopping(&mut self, ctx: &mut Self::Context) -> Running
[src]
fn stopped(&mut self, ctx: &mut Self::Context)
[src]
fn start(self) -> Addr<Self> where
Self: Actor<Context = Context<Self>>,
[src]
Self: Actor<Context = Context<Self>>,
fn start_default() -> Addr<Self> where
Self: Actor<Context = Context<Self>> + Default,
[src]
Self: Actor<Context = Context<Self>> + Default,
fn start_in_arbiter<F>(arb: &Arbiter, f: F) -> Addr<Self> where
F: FnOnce(&mut Context<Self>) -> Self + Send + 'static,
Self: Actor<Context = Context<Self>>,
[src]
F: FnOnce(&mut Context<Self>) -> Self + Send + 'static,
Self: Actor<Context = Context<Self>>,
fn create<F>(f: F) -> Addr<Self> where
F: FnOnce(&mut Context<Self>) -> Self,
Self: Actor<Context = Context<Self>>,
[src]
F: FnOnce(&mut Context<Self>) -> Self,
Self: Actor<Context = Context<Self>>,
impl Debug for HashMapActor
[src]
impl Default for HashMapActor
[src]
impl Handler<ExpiryRequest> for HashMapActor
[src]
type Result = ResponseActFuture<Self, ExpiryResponse>
The type of value that this handler will return. Read more
fn handle(&mut self, msg: ExpiryRequest, _: &mut Self::Context) -> Self::Result
[src]
impl Handler<ExpiryStoreRequest> for HashMapActor
[src]
type Result = ResponseActFuture<Self, ExpiryStoreResponse>
The type of value that this handler will return. Read more
fn handle(
&mut self,
msg: ExpiryStoreRequest,
_: &mut Self::Context
) -> Self::Result
[src]
&mut self,
msg: ExpiryStoreRequest,
_: &mut Self::Context
) -> Self::Result
impl Handler<StoreRequest> for HashMapActor
[src]
type Result = ResponseActFuture<Self, StoreResponse>
The type of value that this handler will return. Read more
fn handle(&mut self, msg: StoreRequest, ctx: &mut Self::Context) -> Self::Result
[src]
Auto Trait Implementations
impl !RefUnwindSafe for HashMapActor
impl Send for HashMapActor
impl Sync for HashMapActor
impl Unpin for HashMapActor
impl !UnwindSafe for HashMapActor
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,