devin
devin
CDCloudflare Developers
Created by devin on 1/7/2025 in #workers-help
create TTL cache in CF worker
I got it to work. The cache control was on request not response
18 replies
CDCloudflare Developers
Created by devin on 1/7/2025 in #workers-help
create TTL cache in CF worker
Any idea why we're undefined here Chaika?
const myCache = await caches.open('custom:cache');
const key = 'https://bla.com';
const cacheKey = new Request(key, {
headers: new Headers({
'cache-control': 'public, max-age=3600',
}),
});

await myCache.put(cacheKey, new Response('hello'));

const res = await myCache.match(cacheKey);

console.log(res);
const myCache = await caches.open('custom:cache');
const key = 'https://bla.com';
const cacheKey = new Request(key, {
headers: new Headers({
'cache-control': 'public, max-age=3600',
}),
});

await myCache.put(cacheKey, new Response('hello'));

const res = await myCache.match(cacheKey);

console.log(res);
18 replies
CDCloudflare Developers
Created by devin on 1/7/2025 in #workers-help
create TTL cache in CF worker
I don't hate it but it still keeps us at the mercy of the network request which could be tampered with
18 replies
CDCloudflare Developers
Created by devin on 1/7/2025 in #workers-help
create TTL cache in CF worker
e.g., trigger a network request which alerts team in slack
18 replies
CDCloudflare Developers
Created by devin on 1/7/2025 in #workers-help
create TTL cache in CF worker
My scenario is more like: user may click a button repeatedly and try something which is fine (can go through expected code path). But in the code path I want to trigger an alert once and only once
18 replies
CDCloudflare Developers
Created by devin on 1/7/2025 in #workers-help
create TTL cache in CF worker
My alternative here is to spin up a new CF worker that leverages KV I think?
18 replies
CDCloudflare Developers
Created by devin on 1/7/2025 in #workers-help
create TTL cache in CF worker
Thank you Chaika. Despite being in the Oxygen runtime I think the Cache API may indeed be an option. It seems to me that subsequent requests will likely be the same PoP, no?
18 replies
CDCloudflare Developers
Created by devin on 9/20/2024 in #workers-help
Observe console logs for cron
Yeah I tried all that actually and it didn't work for some reason. But I'm also looking for a better long term solution because I need the logs to persist so that I don't have to babysit on execution. Any ideas on it? Maybe dump into KV?
5 replies
CDCloudflare Developers
Created by MazeMage on 9/21/2024 in #workers-help
Turso worker
This is also an interesting take although my experience has been different https://newbeelearn.com/blog/comparison-of-hosted-sqlite-service/
3 replies
CDCloudflare Developers
Created by MazeMage on 9/21/2024 in #workers-help
Turso worker
No description
3 replies