Workers KV Read API

Any plan to add the following to the read api?

  1. Get keys by specifying a pattern/wildcard, including the ability to get a list of all keys
  2. Time out old keys

Im asking because you charge for storage usage and there should be ways to avoid stale keys that are taking up needless storage.

2 Likes

Short answer is yes. We are planning on both the ability to expire KV pairs, and the ability to LIST and GET by range.

1 Like

I see the ability to set expirations has been added to the REST API and the Workers interface.

Any update on the ability to list keys or a subset thereof from the Workers interface?

Thanks,

Jason.

List Keys

GET /storage/kv/namespaces/:namespace_id/keys

Yes, that’s the Web API. I’m asking about the Workers API, something like

  var keys = await myNamespace.get(null)
  /* loop through list */

Or…

  var keys = await myNamespace.keys(pattern)
  /* loop through list */

where pattern expands to match some, all or none of the keys.

Thanks,

Jason.

Is this feature ready yet?

For the first point, yes, see 2019/7/26 Workers Release Notes

1 Like