风易: Do not call the upstream response live every time; use the Cache API for edge caching
On 2026-11-18, X user @Michael_liyang (风易) wrote: do not call the upstream response live every time; use the Cache API for edge caching. The approach is: the request checks the Cache API first and returns directly on a hit; on a miss, call upstream, write the successful response into the cache with a TTL; write operations do not enter the cache, and the hit rate is recorded in the D1 daily report. The chain is request → check cache → return on hit → call upstream on miss → write back → return. The author's judgment: what is cached is the upstream result, not your business state.
- Products
- WorkersD1
- Source
- Author experience𝕏 post
- Author
- 风易 (@Michael_liyang)
Key points
- This is a new Cache API tutorial by this author. It is a different topic from cache penetration (empty results also need to be cached) and TTL jitter, so it is a separate piece. The author uses "白嫖" to describe edge caching; here it is recorded in the sense of using the Cache API for free, and it is not a bill that has already occurred.
Original sources
Published
Original post
Read on 𝕏On 2026-11-18, X user @Michael_liyang (风易) wrote: do not call the upstream response live every time; use the Cache API for edge caching. The approach is: the request checks the Cache API first and returns directly on a hit; on a miss, call upstream, write the successful response into the cache with a TTL; write operations do not enter the cache, and the hit rate is recorded in the D1 daily report. The chain is request → check cache → return on hit → call upstream on miss → write back → return. The author's judgment: what is cached is the upstream result, not your business state.
风易 | AI 工具链
@Michael_liyang · Original 𝕏 post
先说结论:上游响应别次次现调,Cache API 白嫖边缘缓存。做法:1 请求先查 Cache API,命中直接返;2 未命中调上游,成功响应写缓存带 TTL;3 写操作不进缓存,命中率记进 D1 日报。链路:请求→查缓存→命中返→未命中调上游→回写→返回。判断:缓存的是上游结果,不是你的业务状态。
More to read
Jonhoni99: Workers AI's 10,000 Neurons per day reset at 8:00 Beijing time, but some models must have a payment method bound first
On 2026-11-13, X user @Jonhoni99 wrote: Cloudflare's 10,000 Neurons are cleared to zero every day at 8:00 Beijing time. The catch is that models such as Kimi K2.6, GLM-5.3, and DeepSeek V4 Pro require a payment method to be bound; the official list has 9, and the free quota cannot be used. On the same day @Nyerishi also pointed out that DeepSeek V4.1 Flash on the Workers AI free plan requires a Workers Paid subscription to actually access it. These are the author's checks against the official catalog, not a bill that has already occurred.
hiromsaeden: an unindexed D1 query loop billed $2,129.00; a $953.74 courtesy credit left $645.38 due.
Cloudflare Community user hiromsaeden, in a post-mortem of a personal hobby project on Workers and D1, says an unindexed GROUP BY aggregate query scanned about 877,000 rows to return 30 rows, and an unintended loop triggered about 315,000 runs across two billing cycles. In the Oct 15 – Nov 15 cycle alone, 1,447,580,203,670 rows (1.44 trillion rows) were read, on top of the previous cycle’s usage. The author says the October invoice IN-83890481 was $529.88 USD, paid in full out of pocket; the November invoice IN-89082487 was $1,599.12 USD ($1,447.58 D1 Rows Read + $6.16 Workers CPU + $145.38 tax); and the total billed was $2,129.00 USD against an expected budget of about $20/month. After noticing the issue on Nov 2–3, the author deleted the Worker and the D1 database; Support confirmed all reads had stopped. In case #02408621, Support offered a $275.00 courtesy credit for October and advised holding it until the November invoice was issued on Nov 15. In case #02434399, Support applied a one-time courtesy credit of $953.74 (which included the held $275.00), leaving a final balance of $645.38 USD, and said the review was complete and no further adjustments can be made. The author, having already paid $529.88, says the remaining $645.38 cannot be afforded and the account will be downgraded on Nov 22. The author also says a budget alert fired once at the $37 mark but did not stop the charges, and that D1 currently has no hard spending cap. There is no Cloudflare staff reply on the public thread; the Support actions are reported by the author.
NatashaTheRobot: a bot that sends a daily Cloudflare billing summary
After a $10 surprise alert, NatashaTheRobot built a scheduled bot that monitors her Cloudflare account and sends a daily billing usage summary, and shared it as a template.