public class RedisConnectionMethods
extends io.toro.martini.redis.RedisBaseMethods
Constructor and Description |
---|
RedisConnectionMethods(DataSourceManager dataSourceManager) |
Modifier and Type | Method and Description |
---|---|
static LettuceRedisDataSource |
connection(String redisConnectionName)
Return Redis datasource object
|
static Collection<RedisCommand> |
dispatch(String connectionName,
Collection<? extends RedisCommand> commands,
io.toro.gloop.engine.GloopExecutionContext context)
Dispatch multiple command in a single write on the channel.
|
static RedisCommand |
dispatch(String connectionName,
RedisCommand command,
io.toro.gloop.engine.GloopExecutionContext context)
Dispatch a command.
|
static Future<Object> |
dispatchAsync(String connectionName,
ProtocolKeyword type,
CommandOutput output,
CommandArgs<Object,Object> args,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously dispatch a command to the redis server.
|
static Future<Object> |
dispatchAsync(String connectionName,
ProtocolKeyword type,
CommandOutput output,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously dispatch a command to the redis server.
|
static Object |
echo(String connectionName,
Object msg,
io.toro.gloop.engine.GloopExecutionContext context)
Echo the given string.
|
static Future<Object> |
echoAsync(String connectionName,
Object msg,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously echo the given string.
|
static void |
flushCommands(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Flush pending commands.
|
static void |
flushCommandsAsync(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously flush pending commands.
|
static ClientOptions |
getOptions(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context) |
static ClientResources |
getResources(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context) |
static Duration |
getTimeout(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context) |
static boolean |
isOpen(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Checks whether the connection to Redis is open or not
|
static String |
ping(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Ping the server.
|
static Future<String> |
pingAsync(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously ping the server.
|
static Long |
publish(String connectionName,
Object channel,
Object message,
io.toro.gloop.engine.GloopExecutionContext context)
Post a message to a channel.
|
static Future<Long> |
publishAsync(String connectionName,
Object channel,
Object message,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously post a message to a channel.
|
static List<Object> |
pubsubChannels(String connectionName,
Object channel,
io.toro.gloop.engine.GloopExecutionContext context)
Lists the currently *active channels*.
|
static Future<List<Object>> |
pubsubChannelsAsync(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously lists the currently *active channels*.
|
static Future<List<Object>> |
pubsubChannelsAsync(String connectionName,
Object channel,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously lists the currently *active channels*.
|
static Long |
pubsubNumpat(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Returns the number of subscriptions to patterns.
|
static Future<Long> |
pubsubNumpatAsync(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously returns the number of subscriptions to patterns.
|
static io.toro.gloop.object.property.GloopModel |
pubsubNumsub(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context,
Object... channels)
Returns the number of subscribers (not counting clients subscribed to patterns) for the specified channels.
|
static Future<Map<Object,Long>> |
pubsubNumsubAsync(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context,
Object... channels)
Asynchronously returns the number of subscribers (not counting clients subscribed to patterns) for the specified
channels.
|
static String |
quit(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Instructs Redis to disconnect the connection.
|
static Future<String> |
quitAsync(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously instructs redis to disconnect the connection.
|
static String |
readOnly(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Switch connection to Read-Only mode when connecting to a cluster.
|
static Future<String> |
readOnlyAsync(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously switch connection to read-Only mode when connecting to a cluster.
|
static String |
readWrite(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Switch connection to Read-Write mode (default) when connecting to a cluster.
|
static Future<String> |
readWriteAsync(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously switch connection to read-Write mode (default) when connecting to a cluster.
|
static void |
reset(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Reset the command state.
|
static void |
resetAsync(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously reset the command state.
|
static List<Object> |
role(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Return the role of the instance in the context of replication.
|
static Future<List<Object>> |
roleAsync(String connectionName,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously return the role of the instance in the context of replication.
|
static void |
setAutoFlushCommands(String connectionName,
boolean autoFlush,
io.toro.gloop.engine.GloopExecutionContext context)
Disable or enable auto-flush behavior.
|
static void |
setAutoFlushCommandsAsync(String connectionName,
boolean autoFlush,
io.toro.gloop.engine.GloopExecutionContext context)
Disable or enable auto-flush behavior.
|
static void |
setTimeout(String connectionName,
Duration timeout,
io.toro.gloop.engine.GloopExecutionContext context)
Set the default command timeout for this connection.
|
static void |
setTimeoutAsync(String connectionName,
Duration timeout,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously set the default command timeout for this connection.
|
static Long |
waitForReplication(String connectionName,
int replicas,
long timeout,
io.toro.gloop.engine.GloopExecutionContext context)
Wait for replication.
|
static Future<Long> |
waitForReplicationAsync(String connectionName,
int replicas,
long timeout,
io.toro.gloop.engine.GloopExecutionContext context)
Asynchronously wait for replication.
|
@Autowired RedisConnectionMethods(DataSourceManager dataSourceManager)
public static LettuceRedisDataSource connection(String redisConnectionName)
redisConnectionName
- the name of the saved database connection in Martinipublic static void setTimeout(@GloopParameter(allowNull=false) String connectionName, Duration timeout, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool nametimeout
- Command timeout.public static void setTimeoutAsync(@GloopParameter(allowNull=false) String connectionName, Duration timeout, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool nametimeout
- Command timeout.public static Duration getTimeout(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namepublic static RedisCommand dispatch(@GloopParameter(allowNull=false) String connectionName, RedisCommand command, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namecommand
- the Redis command.public static Collection<RedisCommand> dispatch(@GloopParameter(allowNull=false) String connectionName, Collection<? extends RedisCommand> commands, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namecommands
- the Redis commands.@GloopParameter(name="redisFutureDispatchOutput") public static Future<Object> dispatchAsync(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) ProtocolKeyword type, @GloopParameter(allowNull=false) CommandOutput output, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool nametype
- the command, must not be null.output
- the command output, must not be null.@GloopParameter(name="redisFutureDispatchOutput") public static Future<Object> dispatchAsync(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) ProtocolKeyword type, @GloopParameter(allowNull=false) CommandOutput output, @GloopParameter(allowNull=false) CommandArgs<Object,Object> args, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool nametype
- the command, must not be null.output
- the command output, must not be null.args
- the command arguments, must not be null.public static boolean isOpen(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namepublic static ClientOptions getOptions(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namepublic static ClientResources getResources(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namepublic static void reset(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namepublic static void resetAsync(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- the Martini Runtime redis connection pool namepublic static void setAutoFlushCommands(@GloopParameter(allowNull=false) String connectionName, boolean autoFlush, io.toro.gloop.engine.GloopExecutionContext context)
#flushCommands(String)
is issued. After calling #flushCommands(String)
commands are sent to the
transport and executed by Redis.connectionName
- The Martini Runtime Redis connection pool nameautoFlush
- state of autoFlush.public static void setAutoFlushCommandsAsync(@GloopParameter(allowNull=false) String connectionName, boolean autoFlush, io.toro.gloop.engine.GloopExecutionContext context)
#flushCommands(String)
is issued. After calling #flushCommands(String)
commands are sent to the
transport and executed by Redis.connectionName
- The Martini Runtime Redis connection pool nameautoFlush
- state of autoFlush.public static void flushCommands(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namepublic static void flushCommandsAsync(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisPublishOutput") public static Long publish(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) Object channel, @GloopParameter(allowNull=false) Object message, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namechannel
- the channel type: keymessage
- the message type: value@GloopParameter(name="redisFuturePublishOutput") public static Future<Long> publishAsync(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) Object channel, @GloopParameter(allowNull=false) Object message, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namechannel
- the channel type: keymessage
- the message type: value@GloopParameter(name="redisPubsubChannelsOutput") public static List<Object> pubsubChannels(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) Object channel, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namechannel
- the key@GloopParameter(name="redisFuturePubsubChannelsOutput") public static Future<List<Object>> pubsubChannelsAsync(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisFuturePubsubChannelsOutput") public static Future<List<Object>> pubsubChannelsAsync(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) Object channel, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namechannel
- the key@GloopObjectParameter(value="output{\nredisMap[]{\n name:object\n value:object\n}\n}") public static io.toro.gloop.object.property.GloopModel pubsubNumsub(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context, @GloopParameter(allowNull=false) Object... channels)
connectionName
- The Martini Runtime Redis connection pool namechannels
- channel keys@GloopParameter(name="redisFuturePubsubNumsubOutput") public static Future<Map<Object,Long>> pubsubNumsubAsync(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context, @GloopParameter(allowNull=false) Object... channels)
connectionName
- The Martini Runtime Redis connection pool namechannels
- channel keys@GloopParameter(name="redisPubsubNumpatOutput") public static Long pubsubNumpat(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisFuturePubsubNumpatOutput") public static Future<Long> pubsubNumpatAsync(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisEchoOutput") public static Object echo(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) Object msg, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namemsg
- the message type: value@GloopParameter(name="redisFutureEchoOutput") public static Future<Object> echoAsync(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) Object msg, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namemsg
- the message type: value@GloopParameter(name="redisRoleOutput") public static List<Object> role(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisFutureRoleOutput") public static Future<List<Object>> roleAsync(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisPingOutput") public static String ping(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisFuturePingOutput") public static Future<String> pingAsync(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisReadOnlyOutput") public static String readOnly(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisFutureReadOnlyOutput") public static Future<String> readOnlyAsync(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisReadWriteOutput") public static String readWrite(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisFutureReadWriteOutput") public static Future<String> readWriteAsync(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisQuitOutput") public static String quit(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
StatefulConnection.close()
to
close connections and release resources.connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisFutureQuitOutput") public static Future<String> quitAsync(@GloopParameter(allowNull=false) String connectionName, io.toro.gloop.engine.GloopExecutionContext context)
StatefulConnection.close()
to close connections and release resources.connectionName
- The Martini Runtime Redis connection pool name@GloopParameter(name="redisWaitForReplicationOutput") public static Long waitForReplication(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) int replicas, @GloopParameter(allowNull=false) long timeout, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namereplicas
- minimum number of replicastimeout
- timeout in milliseconds@GloopParameter(name="redisFutureWaitForReplicationOutput") public static Future<Long> waitForReplicationAsync(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) int replicas, @GloopParameter(allowNull=false) long timeout, io.toro.gloop.engine.GloopExecutionContext context)
connectionName
- The Martini Runtime Redis connection pool namereplicas
- minimum number of replicastimeout
- timeout in millisecondsCopyright © 2020. All rights reserved.