Another good feature of actix-web, in combination with the actix crate, is the ability to use databases. Do you remember how we used SyncArbyter to perform background tasks? It's a good approach to implement database interaction since there are not enough asynchronous database connectors and we have to use synchronous ones. Let's add the caching of responses to a Redis database for our previous example.
Using databases
The database interaction actor
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...