+ renamed methods on template to better convey the meaning
This commit is contained in:
@@ -36,7 +36,7 @@ class DefaultBoundHashOperations<H, HK, HV> extends DefaultKeyBound<H> implement
|
||||
*/
|
||||
public DefaultBoundHashOperations(H key, RedisOperations<H, ?> operations) {
|
||||
super(key);
|
||||
this.ops = operations.hashOps();
|
||||
this.ops = operations.getHashOps();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,7 +36,7 @@ class DefaultBoundListOperations<K, V> extends DefaultKeyBound<K> implements Bou
|
||||
*/
|
||||
public DefaultBoundListOperations(K key, RedisOperations<K, V> operations) {
|
||||
super(key);
|
||||
this.ops = operations.listOps();
|
||||
this.ops = operations.getListOps();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class DefaultBoundSetOperations<K, V> extends DefaultKeyBound<K> implements Boun
|
||||
*/
|
||||
DefaultBoundSetOperations(K key, RedisOperations<K, V> operations) {
|
||||
super(key);
|
||||
this.ops = operations.setOps();
|
||||
this.ops = operations.getSetOps();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,7 +32,7 @@ class DefaultBoundValueOperations<K, V> extends DefaultKeyBound<K> implements Bo
|
||||
*/
|
||||
public DefaultBoundValueOperations(K key, RedisOperations<K, V> operations) {
|
||||
super(key);
|
||||
this.ops = operations.valueOps();
|
||||
this.ops = operations.getValueOps();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,7 +36,7 @@ class DefaultBoundZSetOperations<K, V> extends DefaultKeyBound<K> implements Bou
|
||||
*/
|
||||
public DefaultBoundZSetOperations(K key, RedisOperations<K, V> oeprations) {
|
||||
super(key);
|
||||
this.ops = oeprations.zSetOps();
|
||||
this.ops = oeprations.getZSetOps();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -561,12 +561,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundValueOperations<K, V> forValue(K key) {
|
||||
public BoundValueOperations<K, V> boundValueOps(K key) {
|
||||
return new DefaultBoundValueOperations<K, V>(key, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueOperations<K, V> valueOps() {
|
||||
public ValueOperations<K, V> getValueOps() {
|
||||
return new DefaultValueOperations();
|
||||
}
|
||||
|
||||
@@ -725,12 +725,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListOperations<K, V> listOps() {
|
||||
public ListOperations<K, V> getListOps() {
|
||||
return new DefaultListOperations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundListOperations<K, V> forList(K key) {
|
||||
public BoundListOperations<K, V> boundListOps(K key) {
|
||||
return new DefaultBoundListOperations<K, V>(key, this);
|
||||
}
|
||||
|
||||
@@ -913,12 +913,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
//
|
||||
|
||||
@Override
|
||||
public BoundSetOperations<K, V> forSet(K key) {
|
||||
public BoundSetOperations<K, V> boundSetOps(K key) {
|
||||
return new DefaultBoundSetOperations<K, V>(key, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SetOperations<K, V> setOps() {
|
||||
public SetOperations<K, V> getSetOps() {
|
||||
return new DefaultSetOperations();
|
||||
}
|
||||
|
||||
@@ -1073,12 +1073,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
//
|
||||
|
||||
@Override
|
||||
public BoundZSetOperations<K, V> forZSet(K key) {
|
||||
public BoundZSetOperations<K, V> boundZSetOps(K key) {
|
||||
return new DefaultBoundZSetOperations<K, V>(key, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZSetOperations<K, V> zSetOps() {
|
||||
public ZSetOperations<K, V> getZSetOps() {
|
||||
return new DefaultZSetOperations();
|
||||
}
|
||||
|
||||
@@ -1267,12 +1267,12 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
//
|
||||
|
||||
@Override
|
||||
public <HK, HV> BoundHashOperations<K, HK, HV> forHash(K key) {
|
||||
public <HK, HV> BoundHashOperations<K, HK, HV> boundHashOps(K key) {
|
||||
return new DefaultBoundHashOperations<K, HK, HV>(key, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <HK, HV> HashOperations<K, HK, HV> hashOps() {
|
||||
public <HK, HV> HashOperations<K, HK, HV> getHashOps() {
|
||||
return new DefaultHashOperations<HK, HV>();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +34,6 @@ public interface ZSetOperations<K, V> {
|
||||
|
||||
Set<V> reverseRange(K key, long start, long end);
|
||||
|
||||
void removeRange(K key, long start, long end);
|
||||
|
||||
void removeRangeByScore(K key, double min, double max);
|
||||
|
||||
void unionAndStore(K key, K destKey, Collection<K> keys);
|
||||
|
||||
Boolean add(K key, V value, double score);
|
||||
@@ -50,6 +46,10 @@ public interface ZSetOperations<K, V> {
|
||||
|
||||
Boolean remove(K key, Object o);
|
||||
|
||||
void removeRange(K key, long start, long end);
|
||||
|
||||
void removeRangeByScore(K key, double min, double max);
|
||||
|
||||
Long size(K key);
|
||||
|
||||
RedisOperations<K, V> getOperations();
|
||||
|
||||
@@ -54,7 +54,7 @@ public class RedisAtomicInteger extends Number implements Serializable, KeyBound
|
||||
*/
|
||||
public RedisAtomicInteger(String redisCounter, RedisOperations<String, Integer> operations, int initialValue) {
|
||||
this.key = redisCounter;
|
||||
this.operations = operations.valueOps();
|
||||
this.operations = operations.getValueOps();
|
||||
this.generalOps = operations;
|
||||
this.operations.set(redisCounter, initialValue);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class RedisAtomicLong extends Number implements Serializable, KeyBound<St
|
||||
*/
|
||||
public RedisAtomicLong(String redisCounter, RedisOperations<String, Long> operations, long initialValue) {
|
||||
this.key = redisCounter;
|
||||
this.operations = operations.valueOps();
|
||||
this.operations = operations.getValueOps();
|
||||
this.operations.set(redisCounter, initialValue);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class DefaultRedisList<E> extends AbstractRedisCollection<E> implements R
|
||||
* @param operations
|
||||
*/
|
||||
public DefaultRedisList(String key, RedisOperations<String, E> operations) {
|
||||
this(operations.forList(key));
|
||||
this(operations.boundListOps(key));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -67,7 +67,7 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
* @param operations
|
||||
*/
|
||||
public DefaultRedisMap(String key, RedisOperations<String, ?> operations) {
|
||||
this.hashOps = operations.forHash(key);
|
||||
this.hashOps = operations.boundHashOps(key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ public class DefaultRedisSet<E> extends AbstractRedisCollection<E> implements Re
|
||||
*/
|
||||
public DefaultRedisSet(String key, RedisOperations<String, E> operations) {
|
||||
super(key, operations);
|
||||
boundSetOps = operations.forSet(key);
|
||||
boundSetOps = operations.boundSetOps(key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +74,7 @@ public class DefaultRedisSet<E> extends AbstractRedisCollection<E> implements Re
|
||||
@Override
|
||||
public RedisSet<E> diffAndStore(String destKey, Collection<? extends RedisSet<?>> sets) {
|
||||
boundSetOps.diffAndStore(destKey, CollectionUtils.extractKeys(sets));
|
||||
return new DefaultRedisSet<E>(boundSetOps.getOperations().forSet(destKey));
|
||||
return new DefaultRedisSet<E>(boundSetOps.getOperations().boundSetOps(destKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,7 +85,7 @@ public class DefaultRedisSet<E> extends AbstractRedisCollection<E> implements Re
|
||||
@Override
|
||||
public RedisSet<E> intersectAndStore(String destKey, Collection<? extends RedisSet<?>> sets) {
|
||||
boundSetOps.intersectAndStore(destKey, CollectionUtils.extractKeys(sets));
|
||||
return new DefaultRedisSet<E>(boundSetOps.getOperations().forSet(destKey));
|
||||
return new DefaultRedisSet<E>(boundSetOps.getOperations().boundSetOps(destKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,7 +96,7 @@ public class DefaultRedisSet<E> extends AbstractRedisCollection<E> implements Re
|
||||
@Override
|
||||
public RedisSet<E> unionAndStore(String destKey, Collection<? extends RedisSet<?>> sets) {
|
||||
boundSetOps.unionAndStore(destKey, CollectionUtils.extractKeys(sets));
|
||||
return new DefaultRedisSet<E>(boundSetOps.getOperations().forSet(destKey));
|
||||
return new DefaultRedisSet<E>(boundSetOps.getOperations().boundSetOps(destKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -64,7 +64,7 @@ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements R
|
||||
*/
|
||||
public DefaultRedisZSet(String key, RedisOperations<String, E> operations, double defaultScore) {
|
||||
super(key, operations);
|
||||
boundZSetOps = operations.forZSet(key);
|
||||
boundZSetOps = operations.boundZSetOps(key);
|
||||
this.defaultScore = defaultScore;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements R
|
||||
@Override
|
||||
public RedisZSet<E> intersectAndStore(String destKey, Collection<? extends RedisZSet<?>> sets) {
|
||||
boundZSetOps.intersectAndStore(destKey, CollectionUtils.extractKeys(sets));
|
||||
return new DefaultRedisZSet<E>(boundZSetOps.getOperations().forZSet(destKey), getDefaultScore());
|
||||
return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,7 +126,7 @@ public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements R
|
||||
@Override
|
||||
public RedisZSet<E> unionAndStore(String destKey, Collection<? extends RedisZSet<?>> sets) {
|
||||
boundZSetOps.unionAndStore(destKey, CollectionUtils.extractKeys(sets));
|
||||
return new DefaultRedisZSet<E>(boundZSetOps.getOperations().forZSet(destKey), getDefaultScore());
|
||||
return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -279,7 +279,7 @@ public abstract class AbstractRedisListTests<T> extends AbstractRedisCollectionT
|
||||
|
||||
@Test
|
||||
public void testCappedCollection() throws Exception {
|
||||
RedisList<T> cappedList = new DefaultRedisList<T>(template.forList(collection.getKey() + ":capped"), 1);
|
||||
RedisList<T> cappedList = new DefaultRedisList<T>(template.boundListOps(collection.getKey() + ":capped"), 1);
|
||||
T first = getT();
|
||||
cappedList.offer(first);
|
||||
assertEquals(1, cappedList.size());
|
||||
|
||||
@@ -164,7 +164,7 @@ public abstract class AbstractRedisMapTests<K, V> {
|
||||
@Test
|
||||
public void testNotEquals() {
|
||||
RedisOperations<String, ?> ops = map.getOperations();
|
||||
RedisStore newInstance = new DefaultRedisMap<K, V>(ops.<K, V> forHash(map.getKey() + ":new"));
|
||||
RedisStore newInstance = new DefaultRedisMap<K, V>(ops.<K, V> boundHashOps(map.getKey() + ":new"));
|
||||
assertFalse(map.equals(newInstance));
|
||||
assertFalse(newInstance.equals(map));
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public abstract class AbstractRedisSetTests<T> extends AbstractRedisCollectionTe
|
||||
}
|
||||
|
||||
private RedisSet<T> createSetFor(String key) {
|
||||
return new DefaultRedisSet<T>((BoundSetOperations<String, T>) set.getOperations().forSet(key));
|
||||
return new DefaultRedisSet<T>((BoundSetOperations<String, T>) set.getOperations().boundSetOps(key));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -183,7 +183,7 @@ public abstract class AbstractRedisZSetTest<T> extends AbstractRedisCollectionTe
|
||||
}
|
||||
|
||||
private RedisZSet<T> createZSetFor(String key) {
|
||||
return new DefaultRedisZSet<T>((BoundZSetOperations<String, T>) zSet.getOperations().forZSet(key));
|
||||
return new DefaultRedisZSet<T>((BoundZSetOperations<String, T>) zSet.getOperations().boundZSetOps(key));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user