Endpoint Cache Stats
How much of an endpoint's traffic the edge served from its response cache over the last 24 hours: the cache hit rate. The edge cache is opt-in via a traffic policy with caching rules (or, for a hosted app, the app's own Cache-Control), so only an endpoint that caches has hits.
The numbers come from the endpoint's request logs, so only logged requests count: with request capture off the endpoint has no logged requests and no hit rate (capture_enabled says so). The newest requests can take a few seconds to appear. There is no count of cached entries: each region's edge keeps its own cache.
Path parameters
uuid string (uuid) Req
Endpoint UUID.
Response (200 OK)
window string
Always
"24h": the last 24 hours.requests int
Requests to the endpoint logged in the window.
cache_hits int
Of those, the requests the edge served from its cache.
hit_rate number
cache_hits of requests in percent, one decimal; 0 with no requests.capture_enabled boolean
Whether the endpoint's requests are logged.
false: nothing is counted, so the other fields are 0.Errors
401 Unauthorized
Missing auth.
403 Forbidden
Endpoint doesn't exist or belongs to another user (handler returns 403, not 404, on this path).
500
The request logs couldn't be read. Safe to retry.
Request
curl "https://api.ngris.com/v1/endpoints/<uuid>/cache/stats" \
-H "X-API-KEY: <your_api_key>"
Python
from ngris import Ngris
client = Ngris(api_key="<your_api_key>")
stats = client._get_raw("/endpoints/<endpoint_uuid>/cache/stats")
print(f"{stats['cache_hits']} of {stats['requests']} requests from cache ({stats['hit_rate']}%)")
Response — 200 OK
{
"window": "24h",
"requests": 1234,
"cache_hits": 456,
"hit_rate": 37,
"capture_enabled": true
}
Response — request capture off
{
"window": "24h",
"requests": 0,
"cache_hits": 0,
"hit_rate": 0,
"capture_enabled": false
}
Was this helpful?