Example
Tritone inside a page
No iframe here. The first diagram is a <pre class="tritone"> turned into a diagram by
tritone.run(). The second is a <tritone-diagram> element holding Mermaid text.
story A cache in front of a database
subtitle The second read never reaches the database.
app(service)[App]
cache(cache)[Cache]
db(database)[Database]
step First read
app -> cache: get user:42
cache --> app: miss
app -> db: SELECT user 42
db --> app: row
app -> cache: set user:42
say Nothing is cached yet. The app pays for the database, then leaves a copy behind.
set Read = 24 ms
step Second read
app -> cache: get user:42
cache --> app: hit
note cache: user:42
say The copy answers. The database is not asked at all.
set Read = 1 ms
idea A cache only helps the reads that come after the first one.