Hacker News new | past | comments | ask | show | jobs | submit login

I'm not sure if you know this, and it might not be useful to you even if you do, but workers can interact with the cache directly: https://developers.cloudflare.com/workers/runtime-apis/cache...



Yes, but the worker is in front of the cache (have to pay for an invocation even if cached), and the worker only interacts with the closest cache edge node, not the entire CDN.

But yeah, there are a few hacky ways to work around things. You could have two different URLs and have the client check if the item is stale, if so, call the worker which updates it.

I'm doing something similar with durable objects. I can get it to be persistent by having a cron that calls it every minute and then setting an alarm loop within the object.

It's just super awkward. It feels like a design decision to drive monetization. Cloudflare would be perfect if they let you have a persistent durable object instance that could update global CDN content

It's still the best serverless dev experience for me. Can do everything via JS while having transactional guarantees and globally distributed data right at the edge


I don't think you should need a cron and an alarm, you should be able to just set (and re-set) an alarm in your Durable Object(s)?


Yes you can do that, and it's what I'm doing. But you have to make a request to the durable object first to instantiate it to set the alarm loop




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: