redis.zero: Counter key operations

Description Usage Arguments Details Value Author(s)

View source: R/redis.R

Description

redis.zero resets a counter to zero

redis.inc increments a counter

redis.dec decrements a counter

Usage

1
2
3
redis.zero(rc, key)
redis.inc(rc, key)
redis.dec(rc, key, N0 = FALSE)

Arguments

rc

Redis connection as returned by redis.connect

key

key associated with the counter

N0

logical, if TRUE then counter will be reset to zero if decreasing it leads to negative number.

Details

Counters are implemented directly in Redis and therefore do no behave like any other values set via redis.set since they are not serialized R objects. This is also why they have to be reset using redis.zero and cannot be set using redis.set.

Note that redis.dec with N0=TRUE is currently implemented such that the counter is first decremented and only if it leads to a negative value it is reset to zero.

Value

integer, resulting counter value

Author(s)

Simon Urbanek


s-u/rediscc documentation built on July 22, 2020, 2:18 a.m.