I remember that it could be renamed in the past but now it seems not to work anymore

I remember that it could be renamed in the past but now it seems not to work anymore
17 Replies
thomasgauvin
thomasgauvin2mo ago
Thanks for bringing it up again. This is our top priority fix at the moment. A query that is being made to alert on free quotas is misreporting quotas, so we’re fixing that. I will keep this message thread updated. Note that the query resets every day so you may not encounter this all the time
thipperz
thipperz2mo ago
That's interesting, how do you check the current age of a KV key? I would like to set a high cacheTtl for a key while also being able to show a 'refresh' button if the current value is cached but also 3 days old for example
TigersWay
TigersWay2mo ago
I somehow understand it needs time to fix it, but shouldn't WE have a test period for this kind of things?
JacobMGEvans
JacobMGEvans2mo ago
I'd have to look at how I've done it before but my knee jerk (from my phone) reaction without looking is probably timestamp in the Metadata, maybe something like this
async function setKVValueWithTimestamp(key, value, cacheTtl) {
const timestamp = Date.now();
const data = JSON.stringify({ value, timestamp });
await KV_NAMESPACE.put(key, data, { expirationTtl: cacheTtl });
}
async function setKVValueWithTimestamp(key, value, cacheTtl) {
const timestamp = Date.now();
const data = JSON.stringify({ value, timestamp });
await KV_NAMESPACE.put(key, data, { expirationTtl: cacheTtl });
}
thipperz
thipperz2mo ago
Ahh, sure! Thank you! That will do it
elithrar
elithrar2mo ago
In case you missed it — here's the details on the latest Workers KV performance improvements that just shipped! https://blog.cloudflare.com/faster-workers-kv/ @Workers KV
The Cloudflare Blog
We made Workers KV up to 3x faster — here’s the data
Today, we’re announcing up to 3x faster KV hot reads, with all KV operations faster by up to 20ms. And we want to pull back the curtain and show you how we did it.
AZipr
AZipr2mo ago
Wow! Thats a massive gain!
Devon
Devon2mo ago
that's huge! very nice! Thank you!
thomasgauvin
thomasgauvin2mo ago
We're super excited for this ship, and we're going to continue to make KV super fast for your data globally. The details of how we did it are all in the blog, but the graphs really show the impact 👇
No description
No description
No description
No description
BrianBall
BrianBall2mo ago
In the kv docs /getting-started I can't get this command to work: npx wrangler kv key put --binding=<BINDING_NAME> "<KEY>" "<VALUE>" just trying to follow the kv-tutorial I used kv_binding_name - trying to follow the docs. Though the docs say: name it BINDING_NAME - the very next step shows a create command with kv_binding_name ✘ [ERROR] A namespace with binding name "kv_binding_name" was not found in the configured "kv_namespaces". ✘ [ERROR] A namespace with binding name "kv-tutorial-kv_binding_name" was not found in the configured "kv_namespaces".
No description
BrianBall
BrianBall2mo ago
It does work with the ID - but, I'm just reporting broken documentation continuity.
JamieD132
JamieD1322mo ago
help I am trying to import kv to my javascript worker with import { KVNameSpace } from '@cloudflare/kv-name-space' but it doesn;t work
tadhglewis
tadhglewis2mo ago
it doesn;t work
@JamieD132 What is the error you're getting and what do you expect to get?
tadhglewis
tadhglewis2mo ago
The package mentioned doesn't even exist 🤷 https://www.npmjs.com/package/@cloudflare/kv-name-space
kindaraffy
kindaraffy2mo ago
Hi guys! The documentation is a little murky on this one, how do I specify the expiration on the KV PUT REST body? https://developers.cloudflare.com/api/operations/workers-kv-namespace-write-key-value-pair-with-metadata
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
Marcus
Marcus2mo ago
Ooh yeah they should have an example body there, for sure. I assume it's the same as the wrangler kv bulk put entries: https://developers.cloudflare.com/workers/wrangler/commands/#kv-bulk-put was that a suggestion from an AI tool? that's my best guess :D anyway, follow https://developers.cloudflare.com/kv/get-started/#3-bind-your-worker-to-your-kv-namespace and https://developers.cloudflare.com/kv/get-started/#5-access-your-kv-namespace-from-your-worker to use a KV namespace with a worker
thomasgauvin
thomasgauvin2mo ago
Thanks for flagging! let me verify
Want results from more Discord servers?
Add your server