Hi Is there any way possible to use ipv4 to hit external APi instead of Ipv6
Hi Is there any way possible to use ipv4 to hit external APi instead of Ipv6

wrangler dev --remote the id and tag are empty and timestamp is garbage:worker.js tab shows you have unsaved changes. Control+s should re-enable that button for youStarting on September 23rd, 2024, when your compatibility date is on or after 2024-09-23, the nodejs_compat compatibility flag will enable the exact same behavior as nodejs_compat_v2.



simple = { limit = 10, period = 60 }www.mydomain.com for Webflow and my worker route www.mydomain.com/.well-known/assetlinks.json which provide me a json file.Maximum object size of 512KB. Does this mean I can cache 10s of thousands of fetch responses as long as each response is under the 512KB in size? What are the limits here?Does this mean I can cache 10s of thousands of fetch responses as long as each response is under the 512KB in size? What are the limits here?If they're unpopular they're going to be evicted far before a long ttl. There's no exact hard limit of items you can cache or anything because of that. There's just no guarantees they'll survive any amount of time. Additionally cache is entirely per cloudflare point of presence and not global
interface ExpiringValue<T> {
value: T;
expires: number;
}
// Cloudflare cache namespaces
export const MY_KV_NAMESPACE = 'myservice.internal/v1'
export const MY_CACHE_NAMESPACE = 'https://' + FLAME_KV_NAMESPACE
// These types let you operate on an in-memory cache stored in a Map
/**
* Get a value from cache
* @param store Store to access
* @param key Lookup key
* @returns Stored type
*/
export function cget<T>(store: Map<string, ExpiringValue<T>>, key: string): T | undefined {
const val = store.get(key)
if (!val) return undefined
if(val.expires < (Date.now() / 1000)) {
store.delete(key)
return undefined
}
return val.value
}
/**
* Store a value in cache
* @param store Store to access
* @param key Lookup key
* @param value Value to store
* @param ttl Time to live in seconds
*/
export function cset<T>(store: Map<string, ExpiringValue<T>>, key: string, value: T, ttl: number) {
store.set(key, {
expires: (Date.now() / 1000) + ttl,
value
})
}
/**
* Delete a value in cache
* @param store Store to access
* @param key Lookup key
*/
export function cdel<T>(store: Map<string, ExpiringValue<T>>, key: string) {
store.delete(key)
}const thingCache = new Map<string, ExpiringValue<ThingType>>() // Global scope
async function something(id: string) {
let thing = cget(thingCache, id);
if(!thing) {
// Try to get thing from DC cache
const cacheKey = `things/${id}`
const dcache = caches.default
const cachedClient = await dcache.match(`${MY_KV_NAMESPACE}/${cacheKey}`)
if(cachedClient) {
thing = await cachedClient.json()
} else {
// Finally, try getting it from the database
thing = await queryTheDatabase();
if(!thing) return null; // or whatever
// Place it in the DC cache
ctx.waitUntil(dcache.put(`${MY_CACHE_NAMESPACE}/${cacheKey}`, new Response(JSON.stringify(thing), {
status: 200,
headers: {
'cache-control': 'public, max-age=3600' // 1 hour
}
})))
}
// Place it in the in-memory cache
cset(thingCache, id, thing, 3600) // 1 hour
}
return thing;
}{
"id": "",
"tag": "",
"timestamp": "0001-01-01T00:00:00Z"
}Starting on September 23rd, 2024, when your compatibility date is on or after 2024-09-23, the nodejs_compat compatibility flag will enable the exact same behavior as nodejs_compat_v2.[[services]]
binding = "AUTH"
service = "myproject-auth"
entrypoint = "MyProjecAuthEntrypoint"
[[env.production.services]]
binding = "AUTH"
service = "myproject-auth"
entrypoint = "MyProjecAuthEntrypoint"import { serve } from '@hono/node-server'
serve(app)