Building our Redis client
We do not know what the future will hold for our system. When developing web systems, are requirements will change as the problem evolves. Therefore, we have no way of knowing that servers will need to access the cache. Therefore, it makes sense to build a client that is accessible to any Rust server that needs it. For our client, we only need the make a connection to Redis in an async manner and return appropriate errors if needed. With these requirements in mind, the Cargo.toml
file for our cache client takes the following form:
// nanoservices/user-session-cache/cache-client/Cargo.toml
[package]
name = "cache-client"
version = "0.1.0"
edition = "2021"
[dependencies]
redis = { version = "0.25.4", features = ["tokio-comp"] }
tokio = { version = "1.38.0", features = ["full"] }
glue = { path = "../../../glue"}
Before we build any of our functions for our cache processes, we must...