You can list by prefix and then you can randomize the results on the client side fairly easily?
You can list by prefix and then you can randomize the results on the client side fairly easily?

length of your list -> then access that array item directly. flareutils library and I see there's also a list method combining cache and kv. cacheKey = new URL("https://list.better.kv"); axios on Workers, which is sounds like you're trying to dofetch for HTTP calls in Workers. But in Workers, you don't need to do that You can use a KV binding: https://developers.cloudflare.com/workers/runtime-apis/kv/#kv-bindings
axios uses Node's http module, which doesn't exist in Workers. Workers run JavaScript via V8, but not Node.js@cloudflare/workers-types. There's a KVNamespace type which you can assign to env.KV_BINDING or similar, which should work wellfetch is the future anyway especially now it's in Node!fetch is the standard within browsers and runtimes. Having that consistency is really good and it's native!Keys have a maximum length of 512 bytes.

kv for super simple storage on Workers? Basically, we have a boolean that we need to toggle occasionally. The server is doing 10s-100s of millions of lightweight requests per day so KV is surprisingly expensive for this use case. We end up using an environment variable and flipping that variable every time we want to change the value. kv?kv and then we could invalidate every minute or so? Would that be a good solution?But you could automate the task of changing it quite easilyWe need to re-deploy every time we change an
env right? We can't do it on the fly?kv with a cache ttl seems like the right solution. Any thing I'm missing?lengthlet idx = Math.floor(Math.random() * results.keys.length)
# where results is the array returned from list()
let val = results.keys[idx]flareutilslistcacheKey = new URL("https://list.better.kv");axiosaxioshttp@cloudflare/workers-typesKVNamespaceenv.KV_BINDINGkvkvkvkvenv