Summary Offline Cache
API Contract
REST
/api/v1/cache/summaries
6 endpoints
GET
/api/v1/cache/summaries/api/v1/cache/summaries
List all cached annual summary entries
Public
Response Example
{
"data": [
{
"key": "mentor_001:2025",
"mentor_id": "mentor_001",
"year": 2025,
"stale": false,
"age_seconds": 7200,
"written_at": "2026-01-06T06:00:00Z"
},
{
"key": "mentor_001:2024",
"mentor_id": "mentor_001",
"year": 2024,
"stale": true,
"age_seconds": 1296000,
"written_at": "2025-03-15T12:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 2
}
}
GET
/api/v1/cache/summaries/api/v1/cache/summaries/:key
Read a cached annual summary by cache key
Public
Response Example
{
"key": "mentor_001:2025",
"mentor_id": "mentor_001",
"period": {
"year": 2025,
"start_date": "2025-01-01",
"end_date": "2025-12-31"
},
"total_hours": 312.5,
"unique_contacts_helped": 47,
"activity_count": 198,
"activity_type_breakdown": [
{
"activity_type": "one_on_one",
"count": 120,
"hours": 180,
"percentage": 57.6
}
],
"stale": false,
"written_at": "2026-01-06T06:00:00Z"
}
POST
/api/v1/cache/summaries/api/v1/cache/summaries
Write an annual summary to the offline cache
Public
Request Example
{
"key": "mentor_001:2025",
"mentor_id": "mentor_001",
"period": {
"year": 2025,
"start_date": "2025-01-01",
"end_date": "2025-12-31"
},
"total_hours": 312.5,
"unique_contacts_helped": 47,
"activity_count": 198,
"activity_type_breakdown": [
{
"activity_type": "one_on_one",
"count": 120,
"hours": 180,
"percentage": 57.6
}
]
}
Response Example
{
"key": "mentor_001:2025",
"written": true,
"written_at": "2026-01-06T08:00:00Z"
}
PUT
/api/v1/cache/summaries/api/v1/cache/summaries/:key
Overwrite an existing cache entry with updated summary data
Public
Request Example
{
"total_hours": 315,
"unique_contacts_helped": 48,
"activity_count": 200,
"activity_type_breakdown": [
{
"activity_type": "one_on_one",
"count": 122,
"hours": 182,
"percentage": 57.8
}
]
}
Response Example
{
"key": "mentor_001:2025",
"written": true,
"written_at": "2026-01-06T10:00:00Z"
}
DELETE
/api/v1/cache/summaries/api/v1/cache/summaries/:key
Delete a cache entry by key
Public
Response Example
{
"deleted": true,
"key": "mentor_001:2025"
}
GET
/api/v1/cache/summaries/api/v1/cache/summaries/:key/staleness
Check whether a cache entry is stale given a max age
Public
Response Example
{
"key": "mentor_001:2025",
"stale": false,
"age_seconds": 7200,
"max_age_seconds": 86400,
"written_at": "2026-01-06T06:00:00Z"
}