How dipeshlepcha/redis-caching-api works
Redis API Demo is an ASP.NET Core API showcasing Redis-backed distributed caching. HTTP clients use either direct cache CRUD and existence endpoints, or product endpoints that check the cache, fall back to an in-controller simulated product catalog, then cache the result. Both controllers use the cache service, whose implementation serializes values through the distributed-cache abstraction. Startup wires that service to the Redis provider and exposes Swagger in development. Product data is simulated, not backed by a database; source excerpts establish the main request and cache relationships.
Main entry points: Program.cs API host · ProductController.cs Product endpoints · CacheController.cs Cache endpoints · CacheService.cs Cache service
Components 10
API surface
- API host
RedisCacheAPI/Program.cs - Cache endpoints
RedisCacheAPI/Controllers/CacheController.cs - Swagger UI
RedisCacheAPI/Program.cs
Product demo
- Product endpoints
RedisCacheAPI/Controllers/ProductController.cs - Simulated catalog
RedisCacheAPI/Controllers/ProductController.cs
Cache service
- Cache contract
RedisCacheAPI/Services/ICacheService.cs - Cache service
RedisCacheAPI/Services/CacheService.cs - Distributed cache
Other components
- HTTP client
- Redis server
Connections 12
- HTTP client → API host: sends requests
README.md - API host → Cache endpoints: routes controllers
RedisCacheAPI/Program.cs - API host → Product endpoints: routes controllers
RedisCacheAPI/Program.cs - Cache endpoints → Cache contract: calls
RedisCacheAPI/Controllers/CacheController.cs - Product endpoints → Cache contract: calls
RedisCacheAPI/Controllers/ProductController.cs - Product endpoints → Simulated catalog: loads products
RedisCacheAPI/Controllers/ProductController.cs - Cache service → Distributed cache: reads and writes
RedisCacheAPI/Services/CacheService.cs - API host → Cache service: registers service
RedisCacheAPI/Program.cs - API host → Distributed cache: configures Redis provider
RedisCacheAPI/Program.cs - Distributed cache → Redis server: stores cache entries
- API host → Swagger UI: enables in development
RedisCacheAPI/Program.cs - Swagger UI → HTTP client: documents API
README.md