# czotti/count-cache-rs architecture

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

- Interactive diagram: https://gitdiagram.com/czotti/count-cache-rs
- Repository: https://github.com/czotti/count-cache-rs

## Overview

Count Cache is a small Rust library for entries whose access count controls their lifetime. A caller inserts a value with a count, then retrieves it; each successful retrieval decrements the count, and reaching zero removes the entry. Callers can also increment a count or check whether a key exists. The implementation is concentrated in `src/lib.rs`; the graph separates its public behavior from its in-memory state.

Main entry points: [`src/lib.rs`](https://github.com/czotti/count-cache-rs/blob/master/src/lib.rs) (CountCache API)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Library caller"))
node_cache["CountCache API<br/>[lib.rs]"]
node_state[("HashMap state<br/>[lib.rs]")]

node_caller -->|"uses cache"| node_cache
node_cache -->|"stores entries"| node_state
node_cache -->|"updates counts"| node_state
node_cache -->|"reads and removes"| node_state

click node_cache "https://github.com/czotti/count-cache-rs/blob/master/src/lib.rs"
click node_state "https://github.com/czotti/count-cache-rs/blob/master/src/lib.rs"

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_caller toneIndigo
class node_cache,node_state toneAmber
```

## Components

### Other components

- **Library caller**
- [CountCache API](https://github.com/czotti/count-cache-rs/blob/master/src/lib.rs): `src/lib.rs`
- [HashMap state](https://github.com/czotti/count-cache-rs/blob/master/src/lib.rs): `src/lib.rs`

## Connections

- Library caller → CountCache API: uses cache (evidence: `README.md`)
- CountCache API → HashMap state: stores entries (evidence: `src/lib.rs`)
- CountCache API → HashMap state: updates counts (evidence: `src/lib.rs`)
- CountCache API → HashMap state: reads and removes (evidence: `src/lib.rs`)
