Permalink
Browse files

Improved internal multi bulk send; fixed hanging bug in redisKeys() w…

…ith no keys in DB; added more docs
  • Loading branch information...
1 parent 45cba6c commit d9a3222023f8276ac68b8141c1a654c2f2a0d8db B. W. Lewis committed Mar 11, 2010
Showing with 326 additions and 1 deletion.
  1. +1 −1 man/redisLRem.Rd
  2. +36 −0 man/redisLSet.Rd
  3. +46 −0 man/redisLTrim.Rd
  4. +44 −0 man/redisSAdd.Rd
  5. +34 −0 man/redisSCard.Rd
  6. +32 −0 man/redisSMembers.Rd
  7. +29 −0 man/redisSMove.Rd
  8. +36 −0 man/redisSPop.Rd
  9. +39 −0 man/redisSRem.Rd
  10. +29 −0 man/redisSelect.Rd
View
@@ -18,7 +18,7 @@ Remove elements matching this value from the list.
}
}
\details{
-Remove the first \code{count} occurrences of the \count{value} element from the
+Remove the first \code{count} occurrences of the \code{value} element from the
list. If \code{count} is zero all the elements are removed. If count is
negative elements are removed from tail to head, instead of the default removal
behavior from head to tail. So for example \code{redisLRem} with count -2 and
View
@@ -0,0 +1,36 @@
+\name{redisLSet}
+\alias{redisLSet}
+\title{Set a value within a list.}
+\description{Set the value of an element at the given index in a
+list corresponding to the specified key.
+}
+\usage{
+redisLSet(key, index, value)
+}
+\arguments{
+ \item{key}{A key corresponding to a Redis list.
+}
+ \item{index}{The index within the list of the element to write to.
+}
+ \item{value}{The value to set.
+}
+}
+\details{
+Out of range indices throw an error.
+}
+\value{
+}
+\references{
+http://code.google.com/p/redis/wiki/LSetCommand
+}
+\author{
+B. W. Lewis
+}
+\seealso{
+\code{\link{redisBRpop}}
+}
+\examples{
+\dontrun{
+redisConnect()
+}
+}
View
@@ -0,0 +1,46 @@
+\name{redisLTrim}
+\alias{redisLTrim}
+\title{Trim a list.}
+\description{
+Trim an existing list so that it will contain only the specified range of
+elements specified.
+}
+\usage{
+redisLTrim(key, start, end)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+ \item{key}{A key corresponding to a Redis list object.
+}
+ \item{start}{The starting list index at which to trim.
+}
+ \item{end}{The ending list index at which to trim.
+}
+}
+\details{
+Start and end are zero-based indexes. 0 is the first
+element of the list (the list head), 1 the next element and so on.
+}
+\value{
+TRUE if successful. An error is thrown if the key does not exist or
+correspond to a list value.
+}
+\references{
+http://code.google.com/p/redis/wiki/LtrimCommand
+}
+\author{
+B. W. Lewis
+}
+\seealso{
+\code{\link{redisLPush}}
+}
+\examples{
+\dontrun{
+redisConnect()
+redisLPush('x',1)
+redisLPush('x',2)
+redisLPush('x',3)
+redisLTrim('x',0,1)
+redisLRange('x',0,99)
+}
+}
View
@@ -0,0 +1,44 @@
+\name{redisSAdd}
+\alias{redisSAdd}
+\title{
+Add an element to a set.
+}
+\description{
+Add the element to the specified set.
+}
+\usage{
+redisSAdd(set, element)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+ \item{set}{
+The string set identifier.
+}
+ \item{element}{
+The object to add to the set.
+}
+}
+\details{
+ If member is already a member of the set no operation is performed. If key
+does not exist a new set with the specified member as sole member is created.
+If the key exists but does not hold a set value an error is returned.
+}
+\value{
+1 if the element was successfully added, 0 otherwise (including cases in
+which the element already belonged to the set).
+}
+\references{
+http://code.google.com/p/redis/wiki/SaddCommand
+}
+\author{
+B. W. Lewis
+}
+\seealso{
+\code{\link{redisSRem}}
+}
+\examples{
+\dontrun{
+redisConnect()
+redisSAdd("set", 5)
+}
+}
View
@@ -0,0 +1,34 @@
+\name{redisSCard}
+\alias{redisSCard}
+\title{Set cardinality}
+\description{
+Return the number of elements contained in the specified set.
+}
+\usage{
+redisSCard(set)
+}
+\arguments{
+ \item{set}{
+A string set identifier.
+}
+}
+\value{
+The function returns an integer corresponding to the number of elements
+in the set. Zero is returned if the set is empty or if the set does not exist.
+}
+\references{
+http://code.google.com/p/redis/wiki/ScardCommand
+}
+\author{
+B. W. Lewis
+}
+\seealso{
+\code{\link{redisSAdd}}
+}
+\examples{
+\dontrun{
+redisConnect()
+redisSAdd("set",5)
+redisSCard("set")
+}
+}
View
@@ -0,0 +1,32 @@
+\name{redisSMembers}
+\alias{redisSMembers}
+\title{List elements of a set.}
+\description{Return a list containing all the members (elements)
+of the specified set.
+}
+\usage{
+redisSMembers(set)
+}
+\arguments{
+ \item{set}{The set name (character).} }
+\details{ }
+\value{
+A list containing the set elements. An error is thrown if the set does
+not exist.
+}
+\references{
+http://code.google.com/p/redis/wiki/SmembersCommand
+}
+\author{
+B. W. Lewis
+}
+\seealso{
+\code{\link{redisSAdd}}
+}
+\examples{
+\dontrun{
+redisConnect()
+redisSAdd('set',runif(5))
+redisSMembers('set')
+}
+}
View
@@ -0,0 +1,29 @@
+\name{redisSMove}
+\alias{redisSMove}
+\title{Move a set element.}
+\description{
+Move the specified element from one set to another.
+}
+\usage{
+redisSMove(setA, setB, element)
+}
+\arguments{
+ \item{setA}{The set to move from (character identifier).}
+ \item{setB}{The set to move to (character identifier).}
+ \item{element}{The element to move.}
+}
+\details{Note that the set element is specified as the actual set element object, not an index value.
+}
+\value{1 if successful, 0 otherwise.
+}
+\references{
+http://code.google.com/p/redis/wiki/SmoveCommand
+}
+\author{
+B. W. Lewis
+}
+\seealso{
+\code{\link{redisSAdd}}
+}
+\examples{
+}
View
@@ -0,0 +1,36 @@
+\name{redisSPop}
+\alias{redisSPop}
+\title{Remove an element from a set.}
+\description{
+Remove an element, chosen at random, from the specified set.
+}
+\usage{
+redisSPop(set)
+}
+\arguments{
+ \item{set}{The set name (character).}
+}
+\details{ }
+\value{A random element of the set, or NULL if the set is empty or does
+not exist.}
+\references{
+http://code.google.com/p/redis/wiki/SpopCommand
+}
+\author{
+B. W. Lewis
+}
+\seealso{
+\code{\link{redisSAdd}}
+}
+\examples{
+\dontrun{
+redisConnect()
+redisSAdd('set',runif(2))
+redisSAdd('set',runif(3))
+redisSAdd('set',runif(4))
+redisSPop('set')
+redisSPop('set')
+redisSPop('set')
+redisSPop('set')
+}
+}
View
@@ -0,0 +1,39 @@
+\name{redisSRem}
+\alias{redisSRem}
+\title{Remove an element from a set.}
+\description{
+Remove an element from a set.
+}
+\usage{
+redisSRem(set, element)
+}
+\arguments{
+ \item{set}{The set name (character) from which to remove the element.}
+ \item{element}{The element to remove (not and index, but the actual element
+value).}
+}
+\details{
+The set element matching the specified element will be removed from the set.
+}
+\value{
+1 upon successful removal, 0 otherwise.
+}
+\references{
+http://code.google.com/p/redis/wiki/SremCommand
+}
+\author{
+B. W. Lewis
+}
+\seealso{
+\code{\link{redisSAdd}}
+}
+\examples{
+\dontrun{
+redisConnect()
+redisSAdd('set', 5)
+redisSAdd('set', 7)
+redisSMembers('set')
+redisSRem('set',5)
+redisSMembers('set')
+}
+}
View
@@ -0,0 +1,29 @@
+\name{redisSelect}
+\alias{redisSelect}
+\title{Select a redis database.}
+\description{Select a database by numeric index value.}
+\usage{
+redisSelect(index)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+ \item{index}{The nonnegative integer value of the database to select.}
+}
+\details{Redis supports multiple databases indexed by nonnegative integers.
+The number of supported databases is configurable via the redis server
+configuration file. New connections are assigned to database 0 by default.
+}
+\value{A character string status code. An error is thrown if the index
+value is invalid.}
+\references{
+http://code.google.com/p/redis/wiki/SelectCommand
+}
+\author{
+B. W. Lewis
+}
+\examples{
+\dontrun{
+redisConnect()
+redisSelect(1)
+}
+}

0 comments on commit d9a3222

Please sign in to comment.