new methods added to RedissonClient interface

pull/243/head
Nikita 10 years ago
parent 1d42dc3123
commit bf64e3a95d

@ -296,6 +296,7 @@ public class Redisson implements RedissonClient {
/**
* Shuts down Redisson instance <b>NOT</b> Redis server
*/
@Override
public void shutdown() {
connectionManager.shutdown();
}
@ -307,6 +308,7 @@ public class Redisson implements RedissonClient {
*
* @return Config object
*/
@Override
public Config getConfig() {
return config;
}
@ -322,6 +324,7 @@ public class Redisson implements RedissonClient {
* @param pattern
* @return
*/
@Override
public Queue<String> findKeysByPattern(String pattern) {
return commandExecutor.get(findKeysByPatternAsync(pattern));
}
@ -337,6 +340,7 @@ public class Redisson implements RedissonClient {
* @param pattern
* @return
*/
@Override
public Future<Queue<String>> findKeysByPatternAsync(String pattern) {
return commandExecutor.readAllAsync(RedisCommands.KEYS, pattern);
}
@ -352,6 +356,7 @@ public class Redisson implements RedissonClient {
* @param pattern
* @return
*/
@Override
public long deleteByPattern(String pattern) {
return commandExecutor.get(deleteByPatternAsync(pattern));
}
@ -367,6 +372,7 @@ public class Redisson implements RedissonClient {
* @param pattern
* @return
*/
@Override
public Future<Long> deleteByPatternAsync(String pattern) {
return commandExecutor.evalWriteAllAsync(RedisCommands.EVAL_INTEGER, new SlotCallback<Long, Long>() {
AtomicLong results = new AtomicLong();
@ -393,6 +399,7 @@ public class Redisson implements RedissonClient {
* @param keys - object names
* @return
*/
@Override
public long delete(String ... keys) {
return commandExecutor.get(deleteAsync(keys));
}
@ -403,6 +410,7 @@ public class Redisson implements RedissonClient {
* @param keys - object names
* @return
*/
@Override
public Future<Long> deleteAsync(String ... keys) {
return commandExecutor.writeAllAsync(RedisCommands.DEL, new SlotCallback<Long, Long>() {
AtomicLong results = new AtomicLong();
@ -418,15 +426,30 @@ public class Redisson implements RedissonClient {
}, (Object[])keys);
}
/**
* Delete all the keys of the currently selected database
*/
@Override
public void flushdb() {
commandExecutor.get(commandExecutor.writeAllAsync(RedisCommands.FLUSHDB));
}
/**
* Delete all the keys of all the existing databases
*/
@Override
public void flushall() {
commandExecutor.get(commandExecutor.writeAllAsync(RedisCommands.FLUSHALL));
}
/**
* Return batch object which executes group of
* command in pipeline.
*
* See <a href="http://redis.io/topics/pipelining">http://redis.io/topics/pipelining</a>
*
* @return
*/
@Override
public RBatch createBatch() {
return new RedissonBatch(connectionManager);

@ -17,7 +17,10 @@ package org.redisson;
import org.redisson.core.*;
import io.netty.util.concurrent.Future;
import java.util.List;
import java.util.Queue;
public interface RedissonClient {
@ -160,4 +163,96 @@ public interface RedissonClient {
*/
RBatch createBatch();
/**
* Shuts down Redisson instance <b>NOT</b> Redis server
*/
void shutdown();
/**
* Allows to get configuration provided
* during Redisson instance creation. Further changes on
* this object not affect Redisson instance.
*
* @return Config object
*/
Config getConfig();
/**
* Find keys by key search pattern
*
* Supported glob-style patterns:
* h?llo subscribes to hello, hallo and hxllo
* h*llo subscribes to hllo and heeeello
* h[ae]llo subscribes to hello and hallo, but not hillo
*
* @param pattern
* @return
*/
Queue<String> findKeysByPattern(String pattern);
/**
* Find keys by key search pattern in async mode
*
* Supported glob-style patterns:
* h?llo subscribes to hello, hallo and hxllo
* h*llo subscribes to hllo and heeeello
* h[ae]llo subscribes to hello and hallo, but not hillo
*
* @param pattern
* @return
*/
Future<Queue<String>> findKeysByPatternAsync(String pattern);
/**
* Delete multiple objects by a key pattern
*
* Supported glob-style patterns:
* h?llo subscribes to hello, hallo and hxllo
* h*llo subscribes to hllo and heeeello
* h[ae]llo subscribes to hello and hallo, but not hillo
*
* @param pattern
* @return
*/
long deleteByPattern(String pattern);
/**
* Delete multiple objects by a key pattern in async mode
*
* Supported glob-style patterns:
* h?llo subscribes to hello, hallo and hxllo
* h*llo subscribes to hllo and heeeello
* h[ae]llo subscribes to hello and hallo, but not hillo
*
* @param pattern
* @return
*/
Future<Long> deleteByPatternAsync(String pattern);
/**
* Delete multiple objects by name
*
* @param keys - object names
* @return
*/
long delete(String ... keys);
/**
* Delete multiple objects by name in async mode
*
* @param keys - object names
* @return
*/
Future<Long> deleteAsync(String ... keys);
/**
* Delete all the keys of the currently selected database
*/
void flushdb();
/**
* Delete all the keys of all the existing databases
*/
void flushall();
}

Loading…
Cancel
Save