Permalink
Browse files

Fixed MGet bug in .getResponse function

  • Loading branch information...
1 parent 18ef796 commit fb9aa3c408ef7e677d34fa844dc50938f08157e9 B. W. Lewis committed Mar 12, 2010
Showing with 7 additions and 4 deletions.
  1. +5 −1 R/redis-internal.R
  2. +1 −2 R/strValCMD.R
  3. +1 −1 man/redisMGet.Rd
View
@@ -57,7 +57,11 @@
vals <- vector('list',numVars)
if(!is.null(names)) names(vals) <- names
for (i in 1:numVars) {
- vals[[i]] <- .getResponse()
+# XXX This extra copy is unfortunate, but the default R behavior is
+# not acceptable (assigning a list entry to NULL removes it from the list!)
+# Does anyone have a better idea here?
+ vi <- .getResponse()
+ if(!is.null(vi)) vals[[i]] <- vi
}
}
vals
View
@@ -22,8 +22,7 @@ redisGetSet <- function(key, value) {
}
redisMGet <- function(keys) {
- msg <- paste('MGET ',paste(keys, collapse=' '),'\r\n',sep='')
- .sendCmd(msg,names=keys)
+ .sendCmd(.redismsg('MGET',paste(keys,collapse=' ')),names=keys)
}
redisMSet <- function(keyvalues, NX=FALSE) {
View
@@ -12,7 +12,7 @@ redisMGet(keys)
\details{
}
\value{
-A list of retrieved key/value pairs.
+A list of retrieved key/value pairs. Missing values return NULL.
}
\references{
http://code.google.com/p/redis/wiki/MGetCommand

0 comments on commit fb9aa3c

Please sign in to comment.