Skip to main content

Module store_incr

Module store_incr 

Source
Expand description

store-incr โ€” atomically increments a counter in a named store.

The TTL is applied when the key is created and never refreshed. A counter that bounds retries must expire a fixed time after it first appears; refreshing on every increment means a client that keeps retrying keeps the counter alive and the bound never resets.

Structsยง

StoreIncrPlugin

Constantsยง

INCR_SCRIPT ๐Ÿ”’
INCRBY, then set the expiry only if the key does not already have one. TTL returns a negative value when the key has no expiry, so the guard also repairs a key that somehow lost one. One round trip, atomic.

Functionsยง

parse_by ๐Ÿ”’
Parses the optional by amount, which defaults to 1 and may be negative.
parse_refresh_ttl ๐Ÿ”’
Parses the optional refresh_ttl flag.