:sig
function kv_incr(key : string, by : s64 = 1, ttl_seconds : u64 = 3600) s64

:params
key : the counter key
by : the amount to add, negative to subtract
ttl_seconds : the expiry for a counter created by this call

:returns
the counter value after the change

:content
`kv_incr()` adds to a counter atomically across all workers. A missing counter starts at zero. An existing counter keeps its expiry, so a rate-limit window ends when it was first set to end.

:example capy render
kv_delete("doc-counter")
kv_incr("doc-counter", 1, 60)
print(kv_incr("doc-counter", 2, 60), "\n")

:output
3

:see-group
kv
