January 2019
Intermediate to advanced
520 pages
14h 32m
English
We start by implementing an actor that interacts with a database. Copy the previous example and add the redis crate to the dependencies:
redis = "0.9"
We use Redis because it's great for caching, but we can also store cached values in memory.
Create a src/cache.rs module and add the following dependencies:
use actix::prelude::*;use failure::Error;use futures::Future;use redis::{Commands, Client, RedisError};
It adds types from the redis crate that we already used in Chapter 7, Reliable Integration with Databases, to interact with Redis storage.
Read now
Unlock full access