List of usage examples for org.springframework.data.redis.connection RedisConnection select
void select(int dbIndex);
From source file:com.mauersu.util.redis.DefaultValueOperations.java
public Double increment(K key, final double delta) { final byte[] rawKey = rawKey(key); return execute(new RedisCallback<Double>() { public Double doInRedis(RedisConnection connection) { connection.select(dbIndex); return connection.incrBy(rawKey, delta); }//from w ww .ja v a 2s .c o m }, true); }
From source file:com.mauersu.util.redis.DefaultValueOperations.java
public V get(final Object key) { return execute(new ValueDeserializingRedisCallback(key) { protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { connection.select(dbIndex); return connection.get(rawKey); }//www. jav a 2 s.c o m }, true); }
From source file:com.mauersu.util.redis.DefaultValueOperations.java
public V getAndSet(K key, V newValue) { final byte[] rawValue = rawValue(newValue); return execute(new ValueDeserializingRedisCallback(key) { protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { connection.select(dbIndex); return connection.getSet(rawKey, rawValue); }//w w w . ja v a2s . c om }, true); }
From source file:com.mauersu.util.redis.DefaultValueOperations.java
public Long increment(K key, final long delta) { final byte[] rawKey = rawKey(key); return execute(new RedisCallback<Long>() { public Long doInRedis(RedisConnection connection) { connection.select(dbIndex); return connection.incrBy(rawKey, delta); }/*from w ww . j a v a 2 s . com*/ }, true); }
From source file:com.mauersu.util.redis.DefaultValueOperations.java
public void set(K key, V value) { final byte[] rawValue = rawValue(value); execute(new ValueDeserializingRedisCallback(key) { protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { connection.select(dbIndex); connection.set(rawKey, rawValue); return null; }//from w ww . java 2 s . c o m }, true); }
From source file:com.mauersu.util.redis.DefaultValueOperations.java
public Long size(K key) { final byte[] rawKey = rawKey(key); return execute(new RedisCallback<Long>() { public Long doInRedis(RedisConnection connection) { connection.select(dbIndex); return connection.strLen(rawKey); }//from w w w .ja v a2 s .c o m }, true); }
From source file:com.mauersu.util.redis.DefaultValueOperations.java
public Integer append(K key, String value) { final byte[] rawKey = rawKey(key); final byte[] rawString = rawString(value); return execute(new RedisCallback<Integer>() { public Integer doInRedis(RedisConnection connection) { connection.select(dbIndex); final Long result = connection.append(rawKey, rawString); return (result != null) ? result.intValue() : null; }//from w w w. j ava2 s . c o m }, true); }
From source file:com.mauersu.util.redis.DefaultValueOperations.java
public String get(K key, final long start, final long end) { final byte[] rawKey = rawKey(key); byte[] rawReturn = execute(new RedisCallback<byte[]>() { public byte[] doInRedis(RedisConnection connection) { connection.select(dbIndex); return connection.getRange(rawKey, start, end); }/* www . j av a 2s.c om*/ }, true); return deserializeString(rawReturn); }
From source file:com.mauersu.util.redis.DefaultValueOperations.java
public void set(K key, final V value, final long offset) { final byte[] rawKey = rawKey(key); final byte[] rawValue = rawValue(value); execute(new RedisCallback<Object>() { public Object doInRedis(RedisConnection connection) { connection.select(dbIndex); connection.setRange(rawKey, rawValue, offset); return null; }//from w w w . j a v a 2s . co m }, true); }
From source file:com.mauersu.util.redis.DefaultListOperations.java
public V index(K key, final long index) { return execute(new ValueDeserializingRedisCallback(key) { protected byte[] inRedis(byte[] rawKey, RedisConnection connection) { connection.select(dbIndex); return connection.lIndex(rawKey, index); }// www. j a v a 2 s . c o m }, true); }