+ refactor RedisCollection into RedisStore

This commit is contained in:
Costin Leau
2010-11-09 18:18:49 +02:00
parent eaffa54025
commit 567f7161f3
6 changed files with 42 additions and 37 deletions

View File

@@ -25,7 +25,7 @@ import org.springframework.datastore.redis.connection.RedisCommands;
*
* @author Costin Leau
*/
public abstract class AbstractRedisCollection extends AbstractCollection<String> implements RedisCollection {
public abstract class AbstractRedisCollection extends AbstractCollection<String> implements RedisStore {
protected final String key;
protected final RedisCommands commands;

View File

@@ -39,6 +39,12 @@ public class DefaultRedisSet extends AbstractRedisCollection implements RedisSet
}
}
/**
* Constructs a new <code>DefaultRedisSet</code> instance.
*
* @param key
* @param commands
*/
public DefaultRedisSet(String key, RedisCommands commands) {
super(key, commands);
}

View File

@@ -24,7 +24,7 @@ import java.util.Queue;
*
* @author Costin Leau
*/
public interface RedisList extends RedisCollection, List<String>, Queue<String> {
public interface RedisList extends RedisStore, List<String>, Queue<String> {
List<String> range(int start, int end);

View File

@@ -23,7 +23,7 @@ import java.util.Set;
*
* @author Costin Leau
*/
public interface RedisSet extends RedisCollection, Set<String> {
public interface RedisSet extends RedisStore, Set<String> {
Set<String> intersect(RedisSet... sets);

View File

@@ -24,7 +24,7 @@ import java.util.SortedSet;
*
* @author Costin Leau
*/
public interface RedisSortedSet extends RedisCollection, SortedSet<String> {
public interface RedisSortedSet extends RedisStore, SortedSet<String> {
RedisSortedSet intersectAndStore(String destKey, RedisSortedSet... sets);

View File

@@ -1,33 +1,32 @@
/*
* Copyright 2006-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
import java.util.Collection;
/**
* Basic interface for Redis collections.
*
* @author Costin Leau
*/
public interface RedisCollection extends Collection<String> {
/**
* Returns the key used by the backing Redis store for this collection.
*
* @return Redis key
*/
String getKey();
}
/*
* Copyright 2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
/**
* Basic interface for Redis-based collections.
*
* @author Costin Leau
*/
public interface RedisStore {
/**
* Returns the key used by the backing Redis store for this collection.
*
* @return Redis key
*/
String getKey();
}