redis.zero {rediscc}R Documentation

Counter key operations

Description

redis.zero resets a counter to zero

redis.inc increments a counter

redis.dec decrements a counter

Usage

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


[Package rediscc version 0.1-4 Index]