Episode #582

Setting up and integrating Redis as a key-value store

Series: Build a Vapor Backend

20 minutes
Published on August 6, 2024

This video is only available to subscribers. Get access to this video and 583 others.

Redis is a popular choice for a key-value store for backend applications. This can be used for a multitude of different reasons, such as caching with automatic expiration, rate limiting based on ip address, leaderboards, pub/sub and much more. Its performance characteristics make it a fantastic choice for queuing systems, which we'll cover soon. In this episode we will set up a redis server in our docker compose file, then integrate it into our Vapor application with a simple middleware to count the number of requests to a given path.

Links

  • Redis - The official homepage, docs, etc.
  • Valkey - A new fork of redis that is gaining traction and is backed by Amazon, Google Cloud, Oracle, and others.

This episode uses Redis 6.2, Vapor redis-4.0, Vapor 4.92.