# bisman-singh/lru-cache architecture

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

- Interactive diagram: https://gitdiagram.com/bisman-singh/lru-cache
- Repository: https://github.com/bisman-singh/lru-cache

## Overview

This is a small C++17 LRU-cache implementation accompanied by a runnable demonstration and benchmark. The user workflow is to launch the program, which runs basic operations, demonstrates template flexibility, then compares bounded-cache lookups with an unbounded map. The cache itself combines recency ordering and key lookup; its operations and statistics are implemented together in main.cpp, so they are represented as one component. The graph reflects the single sampled source file.

Main entry points: [`main.cpp`](https://github.com/bisman-singh/lru-cache/blob/main/main.cpp) (Program entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_entry["Program entry<br/>[main.cpp]"]
  node_basic["Basic demo<br/>[main.cpp]"]
  node_templates["Template demo<br/>[main.cpp]"]
  node_cache["LRU cache<br/>[main.cpp]"]
  node_benchmark["Benchmark<br/>[main.cpp]"]
  node_map["Unbounded map<br/>[main.cpp]"]
end

node_user(("User"))

node_user -->|"runs"| node_entry
node_entry -->|"calls"| node_basic
node_entry -->|"calls"| node_templates
node_entry -->|"calls"| node_benchmark
node_basic -->|"uses"| node_cache
node_templates -->|"uses"| node_cache
node_benchmark -->|"benchmarks"| node_cache
node_benchmark -->|"compares"| node_map

click node_entry "https://github.com/bisman-singh/lru-cache/blob/main/main.cpp"
click node_basic "https://github.com/bisman-singh/lru-cache/blob/main/main.cpp"
click node_templates "https://github.com/bisman-singh/lru-cache/blob/main/main.cpp"
click node_cache "https://github.com/bisman-singh/lru-cache/blob/main/main.cpp"
click node_benchmark "https://github.com/bisman-singh/lru-cache/blob/main/main.cpp"
click node_map "https://github.com/bisman-singh/lru-cache/blob/main/main.cpp"

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_entry,node_basic,node_templates,node_cache,node_benchmark,node_map,node_user toneBlue
```

## Components

### Runtime

- [Program entry](https://github.com/bisman-singh/lru-cache/blob/main/main.cpp): `main.cpp`
- [Basic demo](https://github.com/bisman-singh/lru-cache/blob/main/main.cpp): `main.cpp`
- [Template demo](https://github.com/bisman-singh/lru-cache/blob/main/main.cpp): `main.cpp`
- [LRU cache](https://github.com/bisman-singh/lru-cache/blob/main/main.cpp): `main.cpp`
- [Benchmark](https://github.com/bisman-singh/lru-cache/blob/main/main.cpp): `main.cpp`
- [Unbounded map](https://github.com/bisman-singh/lru-cache/blob/main/main.cpp): `main.cpp`

### Other components

- **User**

## Connections

- User → Program entry: runs (evidence: `README.md`)
- Program entry → Basic demo: calls (evidence: `main.cpp`)
- Program entry → Template demo: calls (evidence: `main.cpp`)
- Program entry → Benchmark: calls (evidence: `main.cpp`)
- Basic demo → LRU cache: uses (evidence: `main.cpp`)
- Template demo → LRU cache: uses (evidence: `main.cpp`)
- Benchmark → LRU cache: benchmarks (evidence: `main.cpp`)
- Benchmark → Unbounded map: compares (evidence: `main.cpp`)
