+ add support for [x]pushX commands on RedisConnection

+ add support for blockingRPopLPush on RedisConnection
This commit is contained in:
Costin Leau
2011-01-10 14:15:58 +02:00
parent 4cbf84f89f
commit e19def6de2
3 changed files with 57 additions and 0 deletions

View File

@@ -33,6 +33,10 @@ public interface RedisListCommands {
Long lPush(byte[] key, byte[] value);
Long rPushX(byte[] key, byte[] value);
Long lPushX(byte[] key, byte[] value);
Long lLen(byte[] key);
List<byte[]> lRange(byte[] key, long start, long end);
@@ -56,4 +60,6 @@ public interface RedisListCommands {
List<byte[]> bRPop(int timeout, byte[]... keys);
byte[] rPopLPush(byte[] srcKey, byte[] dstKey);
byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey);
}

View File

@@ -785,6 +785,42 @@ public class JedisConnection implements RedisConnection {
}
}
@Override
public byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey) {
try {
if (isQueueing()) {
throw new UnsupportedOperationException();
}
return jedis.brpoplpush(srcKey, dstKey, timeout).getBytes();
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public Long lPushX(byte[] key, byte[] value) {
try {
if (isQueueing()) {
throw new UnsupportedOperationException();
}
return jedis.lpushx(key, value);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
@Override
public Long rPushX(byte[] key, byte[] value) {
try {
if (isQueueing()) {
throw new UnsupportedOperationException();
}
return jedis.rpushx(key, value);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
//
// Set commands

View File

@@ -516,6 +516,21 @@ public class JredisConnection implements RedisConnection {
throw new UnsupportedOperationException();
}
@Override
public byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey) {
throw new UnsupportedOperationException();
}
@Override
public Long lPushX(byte[] key, byte[] value) {
throw new UnsupportedOperationException();
}
@Override
public Long rPushX(byte[] key, byte[] value) {
throw new UnsupportedOperationException();
}
//
// Set commands