redis.get {rediscc}R Documentation

Get/set/query database content

Description

redis.get retrieves values for given keys

redis.set sets (stores/replaces) values for given keys

redis.rm removes values for given keys

redis.keys lists all keys matching a pattern

Usage

redis.get(rc, keys, list = FALSE)
redis.set(rc, keys, values)
redis.rm (rc, keys)
redis.keys(rc, pattern = NULL)

Arguments

rc

redis connection handle as returned by redis.connect

keys

character vector of keys. For redis.set this can also be a named list in which case the names are used as keys and elements as values.

list

logical, if TRUE then keys is expected to be a single key and the return will be the value. If FALSE then the result is always a list with one value for each key.

values

only used if keys is a character vector. If keys is a single string then the content of values will be stored under that key. Otherwise it must be a list of the same length as keys and each element will be stored under the corresponding key.

pattern

string with a glob-style pattern as suppored by Redis or NULL to retrieve all keys

Details

redis.get retrieves values associated with the speicifed keys. If list is FALSE then keys is expected to be a single string and the value is returned directly. If list is TRUE then a list is returned with one result element for each key element. If a key doesn't exist NULL is returned for that key.

redis.set sets one or more key/value pairs. If keys is of length one then values is interpreted directly as a single value. If keys is a character vector of length of more than one, then values must be a list of the same length. Finally, keys can be a named list in which case values are ignored and names of the list are taken as keys and elements as values.

redis.rm removes a key/value pair from the database. See the note below for the difference of redis.rm and setting a value of NULL.

redis.keys list all matching keys present in the database.

Note

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.

Author(s)

Simon Urbanek

See Also

redis.connect


[Package rediscc version 0.1-4 Index]