Struct hitbox_actix::actor::CacheActor [−][src]
pub struct CacheActor<B> where
B: Backend, { /* fields omitted */ }
Expand description
Actix actor implements cache logic.
This actor implement only Handler<QueryCache>
.
Where QueryCache - Actix message with two fields:
- Generic actix message for sending to upstream actor.
- Address of upstream actor
Example
use actix::prelude::*; use hitbox_actix::{Cache, RedisBackend, CacheError}; #[actix_rt::main] async fn main() -> Result<(), CacheError> { let cache = Cache::new().await?.start(); Ok(()) }
Implementations
impl<B> CacheActor<B> where
B: Actor + Backend,
<B as Actor>::Context: ToEnvelope<B, Get> + ToEnvelope<B, Set> + ToEnvelope<B, Lock> + ToEnvelope<B, Delete>,
[src]
impl<B> CacheActor<B> where
B: Actor + Backend,
<B as Actor>::Context: ToEnvelope<B, Get> + ToEnvelope<B, Set> + ToEnvelope<B, Lock> + ToEnvelope<B, Delete>,
[src]pub async fn new() -> Result<CacheActor<RedisBackend>, CacheError>
[src]
pub async fn new() -> Result<CacheActor<RedisBackend>, CacheError>
[src]Initialize new Cache actor with default hitbox_redis::RedisBackend
.
pub fn builder() -> CacheBuilder<B>
[src]
pub fn builder() -> CacheBuilder<B>
[src]Creates new CacheBuilder instance for Cache actor configuration.
Trait Implementations
impl<B> Actor for CacheActor<B> where
B: Backend,
[src]
impl<B> Actor for CacheActor<B> where
B: Backend,
[src]fn stopping(&mut self, ctx: &mut Self::Context) -> Running
[src]
fn stopping(&mut self, ctx: &mut Self::Context) -> Running
[src]Called after an actor is in Actor::Stopping
state. Read more
fn start(self) -> Addr<Self> where
Self: Actor<Context = Context<Self>>,
[src]
fn start(self) -> Addr<Self> where
Self: Actor<Context = Context<Self>>,
[src]Start a new asynchronous actor, returning its address. Read more
fn start_default() -> Addr<Self> where
Self: Actor<Context = Context<Self>> + Default,
[src]
fn start_default() -> Addr<Self> where
Self: Actor<Context = Context<Self>> + Default,
[src]Construct and start a new asynchronous actor, returning its address. Read more
impl<'a, A, M, B> Handler<QueryCache<A, M>> for CacheActor<B> where
B: Actor + Backend,
<B as Actor>::Context: ToEnvelope<B, Get> + ToEnvelope<B, Set> + ToEnvelope<B, Lock> + ToEnvelope<B, Delete>,
A: Actor + Handler<M> + Send,
M: Message + Cacheable + Send + 'static,
M::Result: MessageResponse<A, M> + CacheableResponse + Debug + Send,
<<M as Message>::Result as CacheableResponse>::Cached: Serialize + DeserializeOwned,
<A as Actor>::Context: ToEnvelope<A, M>,
[src]
impl<'a, A, M, B> Handler<QueryCache<A, M>> for CacheActor<B> where
B: Actor + Backend,
<B as Actor>::Context: ToEnvelope<B, Get> + ToEnvelope<B, Set> + ToEnvelope<B, Lock> + ToEnvelope<B, Delete>,
A: Actor + Handler<M> + Send,
M: Message + Cacheable + Send + 'static,
M::Result: MessageResponse<A, M> + CacheableResponse + Debug + Send,
<<M as Message>::Result as CacheableResponse>::Cached: Serialize + DeserializeOwned,
<A as Actor>::Context: ToEnvelope<A, M>,
[src]type Result = ResponseFuture<Result<<M as Message>::Result, CacheError>>
type Result = ResponseFuture<Result<<M as Message>::Result, CacheError>>
The type of value that this handler will return. Read more
fn handle(
&mut self,
msg: QueryCache<A, M>,
_: &mut Self::Context
) -> Self::Result
[src]
fn handle(
&mut self,
msg: QueryCache<A, M>,
_: &mut Self::Context
) -> Self::Result
[src]This method is called for every message received by this actor.
Auto Trait Implementations
impl<B> !RefUnwindSafe for CacheActor<B>
impl<B> Send for CacheActor<B>
impl<B> Sync for CacheActor<B>
impl<B> Unpin for CacheActor<B>
impl<B> !UnwindSafe for CacheActor<B>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,