Subscribe to data store changes in Workers KV

498 Views Asked by At

Cloudflare Workers KV is an eventually consistent data store. You can write values assigned to keys, and you can read values by key from it. But is there any possibility to listen to some key's value?

In a regular relational DB you can subscribe to changes of an individual row, but are there any similar options for KV?

1

There are 1 best solutions below

3
On BEST ANSWER

There is currently no built-in listen.

You could poll keys for changes, which would probably only make sense if you had a small number of keys. (You can list keys to iterate over them.)

But, since you're the owner of your KV namespace, the best option is probably to wrap your write operations so that you notify some other service/queue that a change has been made.