get_product_metadata
- # readers = ttl_seconds = 300
- def get_product_metadata(product_id):
- key = f"product-metadata:v1:{product_id}"
- cached = cache.get(key)
- fresh =
- if cached is not None:
- return decode(cached)
- product = catalog_db.fetch_metadata(product_id)
- cache.set(key, encode(product), ttl_seconds=300)
- def get_metadata(key, request):
- loader =
- permit =
- Miss80 readers on one key
- Catalog0 reads
product-metadata:v1
Cache-aside, TTL 300 seconds. A fresh entry does not call Catalog. A miss is one key.
Catalog reads 0
0 readers each call catalog_db.fetch_metadata for this missed key.
Live metrics
ReadyThe key is product-metadata:v1. A fresh entry returns from cache without calling Catalog.
Metric definitions
| Metric | Value | What it means |
|---|---|---|
| Catalog reads | 0 | fetch_metadata calls this miss produces. |
| Unavailable | 0 | Readers who got source_read_limit. |
| TTL | 300s | How long a fresh product-metadata entry is kept. |
| Readers | 0 | Requests on this one key. |
0
0
300 s
80