Our Rails App Talking to Redis

Although it’s great that we’ve started up a Redis server using Compose, it’s not much use to us by itself. The whole point of running the Redis server is so our Rails app can talk to it and use it as a key-value store. So let’s connect our Rails app to Redis and actually use it for something. Sound like fun?

Now, there are a million ways an app might want to use Redis. For our purposes, though, we don’t really care what we use Redis for; we care more about how to use it. We’re going to use an intentionally basic example: our Rails app will simply store and retrieve a value. However, keep the larger point in mind—once you know how to set up the Rails app to talk to the Redis server in a container, you can use it ...

Get Docker for Rails Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.