Merge branch 'master' into srp

This commit is contained in:
Costin Leau
2012-06-21 20:05:41 +03:00
24 changed files with 720 additions and 561 deletions

View File

@@ -29,6 +29,11 @@ buildscript {
}
}
repositories {
mavenRepo name: "springsource", urls: "http://repo.springsource.org/libs-snapshot"
}
allprojects {
group = 'org.springframework.data.redis'
version = "$springDataRedisVersion"

View File

@@ -284,7 +284,7 @@
<programlisting language="java"><![CDATA[public class Example {
// inject the actual template
@Autowired
@Resource(name="redisTemplate")
private RedisTemplate<String, String> template;
// inject the template as ListOperations

View File

@@ -13,7 +13,7 @@ junitVersion = 4.8.1
mockitoVersion = 1.8.5
# Drivers
jedisVersion = 2.0.0
jedisVersion = 2.1.0
jredisVersion = 03122010
rjcVersion = 0.6.4
srpVersion = 0.2
@@ -22,7 +22,7 @@ srpVersion = 0.2
## OSGi ranges
spring.range = "[3.1.0, 4.0.0)"
jedis.range = "[2.0.0, 2.0.0]"
jedis.range = "[2.1.0, 2.1.0]"
jackson.range = "[1.6, 2.0.0)"
rjc.range = "[0.6.4, 0.6.4]"
srp.range = "[0.2, 1.0)"

View File

@@ -26,7 +26,7 @@ import org.w3c.dom.Element;
*
* @author Costin Leau
*/
public class RedisCollectionParser extends AbstractSimpleBeanDefinitionParser {
class RedisCollectionParser extends AbstractSimpleBeanDefinitionParser {
protected Class<?> getBeanClass(Element element) {

View File

@@ -372,8 +372,8 @@ public class DefaultStringRedisConnection implements StringRedisConnection {
return delegate.sDiff(keys);
}
public void sDiffStore(byte[] destKey, byte[]... keys) {
delegate.sDiffStore(destKey, keys);
public Long sDiffStore(byte[] destKey, byte[]... keys) {
return delegate.sDiffStore(destKey, keys);
}
public void select(int dbIndex) {
@@ -412,8 +412,8 @@ public class DefaultStringRedisConnection implements StringRedisConnection {
return delegate.sInter(keys);
}
public void sInterStore(byte[] destKey, byte[]... keys) {
delegate.sInterStore(destKey, keys);
public Long sInterStore(byte[] destKey, byte[]... keys) {
return delegate.sInterStore(destKey, keys);
}
public Boolean sIsMember(byte[] key, byte[] value) {
@@ -460,8 +460,8 @@ public class DefaultStringRedisConnection implements StringRedisConnection {
return delegate.sUnion(keys);
}
public void sUnionStore(byte[] destKey, byte[]... keys) {
delegate.sUnionStore(destKey, keys);
public Long sUnionStore(byte[] destKey, byte[]... keys) {
return delegate.sUnionStore(destKey, keys);
}
public Long ttl(byte[] key) {
@@ -1152,4 +1152,17 @@ public class DefaultStringRedisConnection implements StringRedisConnection {
public void openPipeline() {
delegate.openPipeline();
}
public Object execute(String command) {
return execute(command, (byte[][]) null);
}
public Object execute(String command, byte[]... args) {
return delegate.execute(command, args);
}
public Object execute(String command, String... args) {
return execute(command, serializeMulti(args));
}
}

View File

@@ -25,4 +25,16 @@ package org.springframework.data.redis.connection;
public interface RedisCommands extends RedisKeyCommands, RedisStringCommands, RedisListCommands, RedisSetCommands,
RedisZSetCommands, RedisHashCommands, RedisTxCommands, RedisPubSubCommands, RedisConnectionCommands,
RedisServerCommands {
/**
* 'Native' or 'raw' execution of the given command along-side the given arguments.
* The command is executed as is, with as little 'interpretation' as possible - it is up to the caller
* to take care of any processing of arguments or the result.
*
* @param command Command to execute
* @param args Possible command arguments (may be null)
* @return execution result.
*/
Object execute(String command, byte[]... args);
}

View File

@@ -39,15 +39,15 @@ public interface RedisSetCommands {
Set<byte[]> sInter(byte[]... keys);
void sInterStore(byte[] destKey, byte[]... keys);
Long sInterStore(byte[] destKey, byte[]... keys);
Set<byte[]> sUnion(byte[]... keys);
void sUnionStore(byte[] destKey, byte[]... keys);
Long sUnionStore(byte[] destKey, byte[]... keys);
Set<byte[]> sDiff(byte[]... keys);
void sDiffStore(byte[] destKey, byte[]... keys);
Long sDiffStore(byte[] destKey, byte[]... keys);
Set<byte[]> sMembers(byte[] key);

View File

@@ -42,6 +42,10 @@ public interface StringRedisConnection extends RedisConnection {
String getValueAsString();
}
Object execute(String command, String... args);
Object execute(String command);
Boolean exists(String key);
Long del(String... keys);

View File

@@ -58,8 +58,8 @@ public abstract class JedisUtils {
private static final String OK_CODE = "OK";
private static final String OK_MULTI_CODE = "+OK";
private static final byte[] ONE = new byte[] { 1 };
private static final byte[] ZERO = new byte[] { 0 };
private static final byte[] ONE = new byte[] { '1' };
private static final byte[] ZERO = new byte[] { '0' };
/**
* Converts the given, native Jedis exception to Spring's DAO hierarchy.

View File

@@ -53,23 +53,32 @@ abstract class AbstractOperations<K, V> {
protected abstract byte[] inRedis(byte[] rawKey, RedisConnection connection);
}
RedisSerializer keySerializer = null;
RedisSerializer valueSerializer = null;
RedisSerializer hashKeySerializer = null;
RedisSerializer hashValueSerializer = null;
RedisSerializer stringSerializer = null;
RedisTemplate<K, V> template;
AbstractOperations(RedisTemplate<K, V> template) {
keySerializer = template.getKeySerializer();
valueSerializer = template.getValueSerializer();
hashKeySerializer = template.getHashKeySerializer();
hashValueSerializer = template.getHashValueSerializer();
stringSerializer = template.getStringSerializer();
this.template = template;
}
RedisSerializer keySerializer() {
return template.getKeySerializer();
}
RedisSerializer valueSerializer() {
return template.getValueSerializer();
}
RedisSerializer hashKeySerializer() {
return template.getHashKeySerializer();
}
RedisSerializer hashValueSerializer() {
return template.getHashValueSerializer();
}
RedisSerializer stringSerializer() {
return template.getStringSerializer();
}
<T> T execute(RedisCallback<T> callback, boolean b) {
return template.execute(callback, b);
@@ -82,27 +91,27 @@ abstract class AbstractOperations<K, V> {
@SuppressWarnings("unchecked")
byte[] rawKey(Object key) {
Assert.notNull(key, "non null key required");
return keySerializer.serialize(key);
return keySerializer().serialize(key);
}
byte[] rawString(String key) {
return stringSerializer.serialize(key);
return stringSerializer().serialize(key);
}
@SuppressWarnings("unchecked")
byte[] rawValue(Object value) {
return valueSerializer.serialize(value);
return valueSerializer().serialize(value);
}
@SuppressWarnings("unchecked")
<HK> byte[] rawHashKey(HK hashKey) {
Assert.notNull(hashKey, "non null hash key required");
return hashKeySerializer.serialize(hashKey);
return hashKeySerializer().serialize(hashKey);
}
@SuppressWarnings("unchecked")
<HV> byte[] rawHashValue(HV value) {
return hashValueSerializer.serialize(value);
return hashValueSerializer().serialize(value);
}
byte[][] rawKeys(K key, K otherKey) {
@@ -136,31 +145,31 @@ abstract class AbstractOperations<K, V> {
@SuppressWarnings("unchecked")
Set<V> deserializeValues(Set<byte[]> rawValues) {
return SerializationUtils.deserialize(rawValues, valueSerializer);
return SerializationUtils.deserialize(rawValues, valueSerializer());
}
@SuppressWarnings("unchecked")
Set<TypedTuple<V>> deserializeTupleValues(Set<Tuple> rawValues) {
Set<TypedTuple<V>> set = new LinkedHashSet<TypedTuple<V>>(rawValues.size());
for (Tuple rawValue : rawValues) {
set.add(new DefaultTypedTuple(valueSerializer.deserialize(rawValue.getValue()), rawValue.getScore()));
set.add(new DefaultTypedTuple(valueSerializer().deserialize(rawValue.getValue()), rawValue.getScore()));
}
return set;
}
@SuppressWarnings("unchecked")
List<V> deserializeValues(List<byte[]> rawValues) {
return SerializationUtils.deserialize(rawValues, valueSerializer);
return SerializationUtils.deserialize(rawValues, valueSerializer());
}
@SuppressWarnings("unchecked")
<T> Set<T> deserializeHashKeys(Set<byte[]> rawKeys) {
return SerializationUtils.deserialize(rawKeys, hashKeySerializer);
return SerializationUtils.deserialize(rawKeys, hashKeySerializer());
}
@SuppressWarnings("unchecked")
<T> List<T> deserializeHashValues(List<byte[]> rawValues) {
return SerializationUtils.deserialize(rawValues, hashValueSerializer);
return SerializationUtils.deserialize(rawValues, hashValueSerializer());
}
@SuppressWarnings("unchecked")
@@ -181,25 +190,25 @@ abstract class AbstractOperations<K, V> {
@SuppressWarnings("unchecked")
K deserializeKey(byte[] value) {
return (K) keySerializer.deserialize(value);
return (K) keySerializer().deserialize(value);
}
@SuppressWarnings("unchecked")
V deserializeValue(byte[] value) {
return (V) valueSerializer.deserialize(value);
return (V) valueSerializer().deserialize(value);
}
String deserializeString(byte[] value) {
return (String) stringSerializer.deserialize(value);
return (String) stringSerializer().deserialize(value);
}
@SuppressWarnings( { "unchecked" })
<HK> HK deserializeHashKey(byte[] value) {
return (HK) hashKeySerializer.deserialize(value);
return (HK) hashKeySerializer().deserialize(value);
}
@SuppressWarnings("unchecked")
<HV> HV deserializeHashValue(byte[] value) {
return (HV) hashValueSerializer.deserialize(value);
return (HV) hashValueSerializer().deserialize(value);
}
}

View File

@@ -58,7 +58,7 @@ class DefaultBoundZSetOperations<K, V> extends DefaultBoundKeyOperations<K> impl
}
public void intersectAndStore(K destKey, K otherKey) {
public void intersectAndStore(K otherKey, K destKey) {
ops.intersectAndStore(getKey(), otherKey, destKey);
}

View File

@@ -49,8 +49,6 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
return difference(key, Collections.singleton(otherKey));
}
@SuppressWarnings("unchecked")
public Set<V> difference(final K key, final Collection<K> otherKeys) {
final byte[][] rawKeys = rawKeys(key, otherKeys);
Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {
@@ -64,19 +62,18 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
}
public void differenceAndStore(K key, K otherKey, K destKey) {
differenceAndStore(key, Collections.singleton(otherKey), destKey);
public Long differenceAndStore(K key, K otherKey, K destKey) {
return differenceAndStore(key, Collections.singleton(otherKey), destKey);
}
public void differenceAndStore(final K key, final Collection<K> otherKeys, K destKey) {
public Long differenceAndStore(final K key, final Collection<K> otherKeys, K destKey) {
final byte[][] rawKeys = rawKeys(key, otherKeys);
final byte[] rawDestKey = rawKey(destKey);
execute(new RedisCallback<Object>() {
return execute(new RedisCallback<Long>() {
public Object doInRedis(RedisConnection connection) {
connection.sDiffStore(rawDestKey, rawKeys);
return null;
public Long doInRedis(RedisConnection connection) {
return connection.sDiffStore(rawDestKey, rawKeys);
}
}, true);
}
@@ -86,8 +83,6 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
return intersect(key, Collections.singleton(otherKey));
}
@SuppressWarnings("unchecked")
public Set<V> intersect(K key, Collection<K> otherKeys) {
final byte[][] rawKeys = rawKeys(key, otherKeys);
Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {
@@ -101,17 +96,17 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
}
public void intersectAndStore(K key, K otherKey, K destKey) {
intersectAndStore(key, Collections.singleton(otherKey), destKey);
public Long intersectAndStore(K key, K otherKey, K destKey) {
return intersectAndStore(key, Collections.singleton(otherKey), destKey);
}
public void intersectAndStore(K key, Collection<K> otherKeys, K destKey) {
public Long intersectAndStore(K key, Collection<K> otherKeys, K destKey) {
final byte[][] rawKeys = rawKeys(key, otherKeys);
final byte[] rawDestKey = rawKey(destKey);
execute(new RedisCallback<Object>() {
return execute(new RedisCallback<Long>() {
public Object doInRedis(RedisConnection connection) {
public Long doInRedis(RedisConnection connection) {
connection.sInterStore(rawDestKey, rawKeys);
return null;
}
@@ -130,8 +125,6 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
}, true);
}
@SuppressWarnings("unchecked")
public Set<V> members(K key) {
final byte[] rawKey = rawKey(key);
Set<byte[]> rawValues = execute(new RedisCallback<Set<byte[]>>() {
@@ -222,19 +215,18 @@ class DefaultSetOperations<K, V> extends AbstractOperations<K, V> implements Set
}
public void unionAndStore(K key, K otherKey, K destKey) {
unionAndStore(key, Collections.singleton(otherKey), destKey);
public Long unionAndStore(K key, K otherKey, K destKey) {
return unionAndStore(key, Collections.singleton(otherKey), destKey);
}
public void unionAndStore(K key, Collection<K> otherKeys, K destKey) {
public Long unionAndStore(K key, Collection<K> otherKeys, K destKey) {
final byte[][] rawKeys = rawKeys(key, otherKeys);
final byte[] rawDestKey = rawKey(destKey);
execute(new RedisCallback<Object>() {
return execute(new RedisCallback<Long>() {
public Object doInRedis(RedisConnection connection) {
connection.sUnionStore(rawDestKey, rawKeys);
return null;
public Long doInRedis(RedisConnection connection) {
return connection.sUnionStore(rawDestKey, rawKeys);
}
}, true);
}

View File

@@ -73,10 +73,6 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
return connection.decr(rawKey);
}
if (delta < 0) {
return connection.decrBy(rawKey, delta);
}
return connection.incrBy(rawKey, delta);
}
}, true);
@@ -109,8 +105,6 @@ class DefaultValueOperations<K, V> extends AbstractOperations<K, V> implements V
return deserializeString(rawReturn);
}
@SuppressWarnings("unchecked")
public List<V> multiGet(Collection<K> keys) {
if (keys.isEmpty()) {
return Collections.emptyList();

View File

@@ -60,19 +60,18 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
}
public void intersectAndStore(K key, K otherKey, K destKey) {
intersectAndStore(key, Collections.singleton(otherKey), destKey);
public Long intersectAndStore(K key, K otherKey, K destKey) {
return intersectAndStore(key, Collections.singleton(otherKey), destKey);
}
public void intersectAndStore(K key, Collection<K> otherKeys, K destKey) {
public Long intersectAndStore(K key, Collection<K> otherKeys, K destKey) {
final byte[][] rawKeys = rawKeys(key, otherKeys);
final byte[] rawDestKey = rawKey(destKey);
execute(new RedisCallback<Object>() {
return execute(new RedisCallback<Long>() {
public Object doInRedis(RedisConnection connection) {
connection.zInterStore(rawDestKey, rawKeys);
return null;
public Long doInRedis(RedisConnection connection) {
return connection.zInterStore(rawDestKey, rawKeys);
}
}, true);
}
@@ -233,25 +232,23 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
}
public void removeRange(K key, final long start, final long end) {
public Long removeRange(K key, final long start, final long end) {
final byte[] rawKey = rawKey(key);
execute(new RedisCallback<Object>() {
return execute(new RedisCallback<Long>() {
public Object doInRedis(RedisConnection connection) {
connection.zRemRange(rawKey, start, end);
return null;
public Long doInRedis(RedisConnection connection) {
return connection.zRemRange(rawKey, start, end);
}
}, true);
}
public void removeRangeByScore(K key, final double min, final double max) {
public Long removeRangeByScore(K key, final double min, final double max) {
final byte[] rawKey = rawKey(key);
execute(new RedisCallback<Object>() {
return execute(new RedisCallback<Long>() {
public Object doInRedis(RedisConnection connection) {
connection.zRemRangeByScore(rawKey, min, max);
return null;
public Long doInRedis(RedisConnection connection) {
return connection.zRemRangeByScore(rawKey, min, max);
}
}, true);
}
@@ -294,19 +291,18 @@ class DefaultZSetOperations<K, V> extends AbstractOperations<K, V> implements ZS
}
public void unionAndStore(K key, K otherKey, K destKey) {
unionAndStore(key, Collections.singleton(otherKey), destKey);
public Long unionAndStore(K key, K otherKey, K destKey) {
return unionAndStore(key, Collections.singleton(otherKey), destKey);
}
public void unionAndStore(K key, Collection<K> otherKeys, K destKey) {
public Long unionAndStore(K key, Collection<K> otherKeys, K destKey) {
final byte[][] rawKeys = rawKeys(key, otherKeys);
final byte[] rawDestKey = rawKey(destKey);
execute(new RedisCallback<Object>() {
return execute(new RedisCallback<Long>() {
public Object doInRedis(RedisConnection connection) {
connection.zUnionStore(rawDestKey, rawKeys);
return null;
public Long doInRedis(RedisConnection connection) {
return connection.zUnionStore(rawDestKey, rawKeys);
}
}, true);
}

View File

@@ -81,14 +81,8 @@ public abstract class RedisConnectionUtils {
RedisConnection conn = factory.getConnection();
boolean synchronizationActive = TransactionSynchronizationManager.isSynchronizationActive();
if (bind || synchronizationActive) {
if (bind) {
connHolder = new RedisConnectionHolder(conn);
if (synchronizationActive) {
TransactionSynchronizationManager.registerSynchronization(new RedisConnectionSynchronization(
connHolder, factory, true));
}
TransactionSynchronizationManager.bindResource(factory, connHolder);
return connHolder.getConnection();
}

View File

@@ -160,16 +160,16 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
try {
RedisConnection connToExpose = (exposeConnection ? conn : createRedisConnectionProxy(conn));
T result = action.doInRedis(connToExpose);
// close pipeline
if (pipeline && !pipelineStatus) {
conn.closePipeline();
}
// TODO: any other connection processing?
return postProcessResult(result, conn, existingConnection);
} finally {
try {
if (pipeline && !pipelineStatus) {
conn.closePipeline();
}
} finally {
RedisConnectionUtils.releaseConnection(conn, factory);
}
RedisConnectionUtils.releaseConnection(conn, factory);
}
}

View File

@@ -30,25 +30,25 @@ public interface SetOperations<K, V> {
Set<V> difference(K key, Collection<K> otherKeys);
void differenceAndStore(K key, K otherKey, K destKey);
Long differenceAndStore(K key, K otherKey, K destKey);
void differenceAndStore(K key, Collection<K> otherKeys, K destKey);
Long differenceAndStore(K key, Collection<K> otherKeys, K destKey);
Set<V> intersect(K key, K otherKey);
Set<V> intersect(K key, Collection<K> otherKeys);
void intersectAndStore(K key, K otherKey, K destKey);
Long intersectAndStore(K key, K otherKey, K destKey);
void intersectAndStore(K key, Collection<K> otherKeys, K destKey);
Long intersectAndStore(K key, Collection<K> otherKeys, K destKey);
Set<V> union(K key, K otherKey);
Set<V> union(K key, Collection<K> otherKeys);
void unionAndStore(K key, K otherKey, K destKey);
Long unionAndStore(K key, K otherKey, K destKey);
void unionAndStore(K key, Collection<K> otherKeys, K destKey);
Long unionAndStore(K key, Collection<K> otherKeys, K destKey);
Boolean add(K key, V value);

View File

@@ -35,13 +35,13 @@ public interface ZSetOperations<K, V> {
Double getScore();
}
void intersectAndStore(K key, K otherKey, K destKey);
Long intersectAndStore(K key, K otherKey, K destKey);
void intersectAndStore(K key, Collection<K> otherKeys, K destKey);
Long intersectAndStore(K key, Collection<K> otherKeys, K destKey);
void unionAndStore(K key, K otherKey, K destKey);
Long unionAndStore(K key, K otherKey, K destKey);
void unionAndStore(K key, Collection<K> otherKeys, K destKey);
Long unionAndStore(K key, Collection<K> otherKeys, K destKey);
Set<V> range(K key, long start, long end);
@@ -71,9 +71,9 @@ public interface ZSetOperations<K, V> {
Boolean remove(K key, Object o);
void removeRange(K key, long start, long end);
Long removeRange(K key, long start, long end);
void removeRangeByScore(K key, double min, double max);
Long removeRangeByScore(K key, double min, double max);
Long count(K key, double min, double max);

View File

@@ -115,6 +115,15 @@ public abstract class AbstractConnectionIntegrationTests {
assertEquals("PONG", connection.ping());
}
@Test
public void testBitSet() throws Exception {
String key = "bitset-test";
connection.setBit(key, 0, false);
connection.setBit(key, 1, true);
assertTrue(!connection.getBit(key, 0));
assertTrue(connection.getBit(key, 1));
}
@Test
public void testInfo() throws Exception {
Properties info = connection.info();
@@ -323,4 +332,12 @@ public abstract class AbstractConnectionIntegrationTests {
th.start();
connection.pSubscribe(listener, expectedPattern);
}
@Test
public void testExecuteNative() throws Exception {
connection.execute("ZADD", getClass() + "#testExecuteNative", "0.9090", "item");
//connection.execute("PiNg");
connection.execute("iNFo");
connection.execute("SET ", getClass() + "testSetNative", UUID.randomUUID().toString());
}
}

View File

@@ -22,7 +22,6 @@ import org.junit.Test;
import org.springframework.data.redis.SettingsUtils;
import org.springframework.data.redis.connection.AbstractConnectionIntegrationTests;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.jredis.JredisConnectionFactory;
public class JRedisConnectionIntegrationTests extends AbstractConnectionIntegrationTests {
@@ -86,6 +85,10 @@ public class JRedisConnectionIntegrationTests extends AbstractConnectionIntegrat
@Ignore
public void testPubSubWithNamedChannels() {
}
@Ignore
public void testBitSet() throws Exception {
}
}

View File

@@ -15,16 +15,21 @@
*/
package org.springframework.data.redis.core;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Collection;
import java.util.List;
import org.junit.AfterClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.ConnectionFactoryTracker;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.rjc.RjcConnectionFactory;
import org.springframework.data.redis.support.collections.CollectionTestParams;
import org.springframework.data.redis.support.collections.ObjectFactory;
@@ -56,4 +61,36 @@ public class TemplateTest {
public void testKeys() throws Exception {
assertTrue(template.keys("*") != null);
}
@Test
public void testIncrement() throws Exception {
// disable in case of Rjc
if (isRjc()) {
return;
}
StringRedisTemplate sr = new StringRedisTemplate(template.getConnectionFactory());
String key = "test.template.inc";
ValueOperations<String, String> valueOps = sr.opsForValue();
valueOps.set(key, "10");
valueOps.increment(key, -10);
assertEquals(0, Integer.valueOf(valueOps.get(key)).intValue());
valueOps.increment(key, -10);
assertEquals(-10, Integer.valueOf(valueOps.get(key)).intValue());
}
private boolean isRjc() {
return (template.getConnectionFactory() instanceof RjcConnectionFactory);
}
//@Test
public void testGetNonExistingKey() throws Exception {
List<Object> res = (List<Object>) template.execute(new RedisCallback<List<Object>>() {
public List<Object> doInRedis(RedisConnection connection) throws DataAccessException {
connection.hGet("non-existing-key".getBytes(), "some-value".getBytes());
return connection.closePipeline();
}
}, true, true);
}
}