Skip to main content

Exercise 2: Distributed Caching with Redis

Objective

Implement Redis caching for frequently accessed data

Setup

docker run -d -p 6379:6379 redis
dotnet add package Microsoft.Extensions.Caching.StackExchangeRedis

Tasks

  1. Configure Redis
  2. Create cache service
  3. Implement cache-aside pattern
  4. Add cache invalidation
  5. Monitor cache hit/miss

Expected Outcome

  • Working Redis cache
  • Reduced database queries
  • Cache invalidation strategy