The Cache
Channel Stats is a public page: anyone can open it, reload it, or link it somewhere busy. If every visit called the API, one quiet afternoon could burn the whole day's quota.
So the numbers are read once and kept in memory for thirty minutes. Almost every visit is served without leaving the server at all.
A visitor opens the page. No sign-in, no account — anyone at all.
GET /channel
In-memory cache check
One dictionary in the running process, holding the last answer and the moment it was fetched.
Only on
a miss
At most
once / 30 min
channels.list(mine=True)
1 unit
Read with the owner's stored credentials — the same token the update cycle uses, counted against the same daily budget. Subscribers, total views and video count come back in one response.
Store for
30 minutes
Cached — CHANNEL_CACHE_TTL
~48 units / day
Thirty minutes of TTL means at most 48 reads in a day — whether the page gets ten visitors or ten thousand. The cost of this page does not grow with its traffic.
One read serves every visitor Traffic goes up; the quota bill stays flat.