GET
/cache/:namespace/:id
Get cached item
Returns the cached value, remaining TTL, and expiry timestamp. Falls back to a shared entry if no tenant-specific item is found. Expired items are removed and treated as missing.
Request
No body. Tenant identified by header.
| Header | Notes |
|---|---|
x-tenant-id | Required. |
Response 200
{
"value": {
"title": "Hello World"
},
"ttl": 295,
"expiresAt": "2025-01-01T12:05:00.000Z",
"shared": false
}
404 when item is missing or expired.
PUT
/cache/:namespace/:id
Set cached item
Creates or replaces a cached item.
Request body
{
"value": {
"title": "Hello World"
},
"ttl": 300,
"shared": false
}
| Field | Notes |
|---|---|
value | Required. Any JSON value. |
ttl | Optional. Seconds. Defaults to CACHE_DEFAULT_TTL. |
shared | Optional. Cross-tenant fallback. Default false. |
Response 200
{
"namespace": "articles",
"id": "42",
"ttl": 300,
"expiresAt": "2025-01-01T12:05:00.000Z",
"shared": false
}
400 when value is missing or ttl is not a positive number.
DELETE
/cache/:namespace/:id
Delete cached item
Removes a specific item. Idempotent — returns 200 even when no item exists.
Request
No body.
Response 200
No body.
DELETE
/cache/:namespace
Clear namespace
Removes all non-shared items in the given namespace for the requesting tenant.
Request
No body.
Response 200
{
"removed": 5
}
DELETE
/cache
Clear all tenant items
Removes all non-shared cached items for the requesting tenant across all namespaces.
Request
No body.
Response 200
{
"removed": 42
}