Description Usage Arguments Details Value Note Author(s) See Also
redis.push pushes an element to the list
redis.pop pops and element from the list
1 2 | redis.pop(rc, keys, timeout=0, r2l=TRUE)
redis.push(rc, key, value, r2l=TRUE)
|
rc |
redis connection handle as returned by
|
keys |
character vector of keys. Note that Redis only supports
non-blocking POP for singe key, so must be a string if
|
timeout |
integer >= 0 or |
r2l |
logical, if |
key |
string, key |
value |
value to push. Currently, only string values are supported adn they are stored as-is. Multiple values are allowed which corresponds to multiple operations. |
redis.push pushes an element into a list and redis.pop
retrieves elements from the list. This pair of operations is commonly
used to implement queues. If timeout is 0 then only a single key
can be provided and the operation will return NULL if the list
is empty, otherwise one element is popped. If timeout is
> 0 then a list of keys can be provided and it will return the
moment an element is available in any of the lists (see Redis
documentation on BLPOP for exact details). If the timeout
value is not finite, then it blocks forever.
If you think of a FIFO queue, r2l determines the direction in
which the queue will work. If TRUE then elements are pushed
on the right and popped on the left (most common). You can implement a
LIFO queue by using the inverse value for pop vs push (e.g.,
r2l=FALSE for push and r2l=TRUE for pop which will make
the queue entry and exit on the left).
Note that the current implementation only supports direct string values
in redis.push. Also
redis.pop non-blocking version returns the obtained object or
NULL if the list is empty. Blocking operation returns named
vector with the obtained element bearing the name of the key from
which it was obtained.
redis.push returns the number of items in the list
rediscc was originally written as a replacement of
rredis so it shares the serialized value format which has a few
odd implications. rredis doesn't store values directly, but
uses R serialization to store the serialized content in the
value. On the plus side it means that arbitrary values can be stored,
but it also means that storing an integer into a key will result in the
storage of a binary blob such that seemingly intuitive actions like
incrementing it don't work since Redis doesn't recognize it as a
number. Also it means that it is possible to store the value
NULL in the key but this is not distinguishable from the
deleted key since redis.get will return NULL in both
cases.
Simon Urbanek
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.