# dipeshlepcha/redis-caching-api architecture

> Architecture diagram of the GitHub repository dipeshlepcha/redis-caching-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dipeshlepcha/redis-caching-api
- Repository: https://github.com/dipeshlepcha/redis-caching-api

## Overview

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: [`RedisCacheAPI/Program.cs`](https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Program.cs) (API host), [`RedisCacheAPI/Controllers/ProductController.cs`](https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Controllers/ProductController.cs) (Product endpoints), [`RedisCacheAPI/Controllers/CacheController.cs`](https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Controllers/CacheController.cs) (Cache endpoints), [`RedisCacheAPI/Services/CacheService.cs`](https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Services/CacheService.cs) (Cache service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API surface"]
  node_host["API host<br/>[Program.cs]"]
  node_cache_api["Cache endpoints<br/>[CacheController.cs]"]
  node_swagger["Swagger UI<br/>[Program.cs]"]
end

subgraph group_products["Product demo"]
  node_product_api["Product endpoints"]
  node_catalog[("Simulated catalog")]
end

subgraph group_cache["Cache service"]
  node_cache_contract["Cache contract<br/>[ICacheService.cs]"]
  node_cache_service["Cache service<br/>[CacheService.cs]"]
  node_distributed_cache["Distributed cache"]
end

node_client(("HTTP client"))
node_redis[("Redis server")]

node_client -->|"sends requests"| node_host
node_host -->|"routes controllers"| node_cache_api
node_host -->|"routes controllers"| node_product_api
node_cache_api -->|"calls"| node_cache_contract
node_product_api -->|"calls"| node_cache_contract
node_product_api -->|"loads products"| node_catalog
node_cache_service -->|"reads and writes"| node_distributed_cache
node_host -->|"registers service"| node_cache_service
node_host -->|"configures Redis provider"| node_distributed_cache
node_distributed_cache -.->|"stores cache entries"| node_redis
node_host -->|"enables in development"| node_swagger
node_swagger -->|"documents API"| node_client

click node_host "https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Program.cs"
click node_cache_api "https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Controllers/CacheController.cs"
click node_product_api "https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Controllers/ProductController.cs"
click node_catalog "https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Controllers/ProductController.cs"
click node_cache_contract "https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Services/ICacheService.cs"
click node_cache_service "https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Services/CacheService.cs"
click node_swagger "https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Program.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_host,node_cache_api,node_swagger,node_client toneBlue
class node_product_api,node_catalog,node_redis toneAmber
class node_cache_contract,node_cache_service,node_distributed_cache toneMint
```

## Components

### API surface

- [API host](https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Program.cs): `RedisCacheAPI/Program.cs`
- [Cache endpoints](https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Controllers/CacheController.cs): `RedisCacheAPI/Controllers/CacheController.cs`
- [Swagger UI](https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Program.cs): `RedisCacheAPI/Program.cs`

### Product demo

- [Product endpoints](https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Controllers/ProductController.cs): `RedisCacheAPI/Controllers/ProductController.cs`
- [Simulated catalog](https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Controllers/ProductController.cs): `RedisCacheAPI/Controllers/ProductController.cs`

### Cache service

- [Cache contract](https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Services/ICacheService.cs): `RedisCacheAPI/Services/ICacheService.cs`
- [Cache service](https://github.com/dipeshlepcha/redis-caching-api/blob/master/RedisCacheAPI/Services/CacheService.cs): `RedisCacheAPI/Services/CacheService.cs`
- **Distributed cache**

### Other components

- **HTTP client**
- **Redis server**

## Connections

- HTTP client → API host: sends requests (evidence: `README.md`)
- API host → Cache endpoints: routes controllers (evidence: `RedisCacheAPI/Program.cs`)
- API host → Product endpoints: routes controllers (evidence: `RedisCacheAPI/Program.cs`)
- Cache endpoints → Cache contract: calls (evidence: `RedisCacheAPI/Controllers/CacheController.cs`)
- Product endpoints → Cache contract: calls (evidence: `RedisCacheAPI/Controllers/ProductController.cs`)
- Product endpoints → Simulated catalog: loads products (evidence: `RedisCacheAPI/Controllers/ProductController.cs`)
- Cache service → Distributed cache: reads and writes (evidence: `RedisCacheAPI/Services/CacheService.cs`)
- API host → Cache service: registers service (evidence: `RedisCacheAPI/Program.cs`)
- API host → Distributed cache: configures Redis provider (evidence: `RedisCacheAPI/Program.cs`)
- Distributed cache → Redis server: stores cache entries
- API host → Swagger UI: enables in development (evidence: `RedisCacheAPI/Program.cs`)
- Swagger UI → HTTP client: documents API (evidence: `README.md`)
