Package io.toro.martini.redis
Class RedisScriptingMethods
java.lang.Object
io.toro.martini.redis.RedisBaseMethods
io.toro.martini.redis.RedisScriptingMethods
public class RedisScriptingMethods
extends io.toro.martini.redis.RedisBaseMethods
Methods for Scripting.
-
Constructor Summary
ConstructorsConstructorDescriptionRedisScriptingMethods(io.toro.martini.database.DataSourceManager dataSourceManager) -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringdigest(String connectionName, Object script, GloopExecutionContext context) Create a SHA1 digest from a Lua script.static StringdigestAsync(String connectionName, Object script, GloopExecutionContext context) Asynchronously create a SHA1 digest from a lua script.static Objecteval(String connectionName, String script, String type, GloopExecutionContext context, Object... keys) Execute a Lua script server side.static Objecteval(String connectionName, String script, String type, Object[] keys, GloopExecutionContext context, Object... values) Execute a Lua script server side.evalAsync(String connectionName, String script, String type, GloopExecutionContext context, Object... keys) Asynchronously execute a lua script server side.evalAsync(String connectionName, String script, String type, Object[] keys, GloopExecutionContext context, Object... values) Asynchronously execute a lua script server side.static Objectevalsha(String connectionName, String digest, String type, GloopExecutionContext context, Object... keys) Evaluates a script cached on the server side by its SHA1 digeststatic Objectevalsha(String connectionName, String digest, String type, Object[] keys, GloopExecutionContext context, Object... values) Execute a Lua script server side.evalshaAsync(String connectionName, String digest, String type, GloopExecutionContext context, Object... keys) Asynchronously evaluates a script cached on the server side by its sHA1 digeststatic <T> Future<T> evalshaAsync(String connectionName, String digest, String type, Object[] keys, GloopExecutionContext context, Object... values) Asynchronously execute a lua script server side.scriptExists(String connectionName, GloopExecutionContext context, String... digests) Check existence of scripts in the script cache.scriptExistsAsync(String connectionName, GloopExecutionContext context, String... digests) Asynchronously check existence of scripts in the script cache.static StringscriptFlush(String connectionName, GloopExecutionContext context) Remove all the scripts from the script cache.scriptFlushAsync(String connectionName, GloopExecutionContext context) Asynchronously remove all the scripts from the script cache.static StringscriptKill(String connectionName, GloopExecutionContext context) Kill the script currently in execution.scriptKillAsync(String connectionName, GloopExecutionContext context) Asynchronously kill the script currently in execution.static StringscriptLoad(String connectionName, Object script, GloopExecutionContext context) Load the specified Lua script into the script cache.scriptLoadAsync(String connectionName, Object script, GloopExecutionContext context) Asynchronously load the specified lua script into the script cache.Methods inherited from class io.toro.martini.redis.RedisBaseMethods
getDataSourceManager, getRedisConnection, getRedisConnection
-
Constructor Details
-
RedisScriptingMethods
-
-
Method Details
-
eval
@GloopParameter(name="redisEvalOutput") public static Object eval(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) String script, @GloopParameter(allowNull=false,choices={"BOOLEAN","INTEGER","MULTI","STATUS","VALUE"}) String type, GloopExecutionContext context, @GloopParameter(allowNull=false) Object... keys) Execute a Lua script server side.- Parameters:
connectionName- The Martini Runtime Redis connection pool namescript- Lua 5.1 script.type- output typekeys- key names- Returns:
- script result
-
eval
@GloopParameter(name="redisEvalOutput") public static Object eval(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) String script, @GloopParameter(allowNull=false,choices={"BOOLEAN","INTEGER","MULTI","STATUS","VALUE"}) String type, @GloopParameter(allowNull=false) Object[] keys, GloopExecutionContext context, @GloopParameter(allowNull=false) Object... values) Execute a Lua script server side.- Parameters:
connectionName- The Martini Runtime Redis connection pool namescript- Lua 5.1 script.type- the typekeys- the keysvalues- the values- Returns:
- script result
-
evalAsync
@GloopParameter(name="redisFutureEvalOutput") public static Future<Object> evalAsync(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) String script, @GloopParameter(allowNull=false,choices={"BOOLEAN","INTEGER","MULTI","STATUS","VALUE"}) String type, GloopExecutionContext context, @GloopParameter(allowNull=false) Object... keys) Asynchronously execute a lua script server side.- Parameters:
connectionName- The Martini Runtime Redis connection pool namescript- lua 5.1 script.type- output typekeys- key names- Returns:
- script result
-
evalAsync
@GloopParameter(name="redisFutureEvalOutput") public static Future<Object> evalAsync(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) String script, @GloopParameter(allowNull=false,choices={"BOOLEAN","INTEGER","MULTI","STATUS","VALUE"}) String type, @GloopParameter(allowNull=false) Object[] keys, GloopExecutionContext context, @GloopParameter(allowNull=false) Object... values) Asynchronously execute a lua script server side.- Parameters:
connectionName- The Martini Runtime Redis connection pool namescript- lua 5.1 script.type- the typekeys- the keysvalues- the values- Returns:
- script result
-
evalsha
@GloopParameter(name="redisEvalshaOutput") public static Object evalsha(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) String digest, @GloopParameter(allowNull=false,choices={"BOOLEAN","INTEGER","MULTI","STATUS","VALUE"}) String type, GloopExecutionContext context, @GloopParameter(allowNull=false) Object... keys) Evaluates a script cached on the server side by its SHA1 digest- Parameters:
connectionName- The Martini Runtime Redis connection pool namedigest- SHA1 of the scripttype- the typekeys- the keys- Returns:
- script result
-
evalsha
@GloopParameter(name="redisEvalshaOutput") public static Object evalsha(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) String digest, @GloopParameter(allowNull=false,choices={"BOOLEAN","INTEGER","MULTI","STATUS","VALUE"}) String type, @GloopParameter(allowNull=false) Object[] keys, GloopExecutionContext context, @GloopParameter(allowNull=false) Object... values) Execute a Lua script server side.- Parameters:
connectionName- The Martini Runtime Redis connection pool namedigest- SHA1 of the scripttype- the typekeys- the keysvalues- the values- Returns:
- script result
-
evalshaAsync
@GloopParameter(name="redisFutureEvalshaOutput") public static Future<Object> evalshaAsync(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) String digest, @GloopParameter(allowNull=false,choices={"BOOLEAN","INTEGER","MULTI","STATUS","VALUE"}) String type, GloopExecutionContext context, @GloopParameter(allowNull=false) Object... keys) Asynchronously evaluates a script cached on the server side by its sHA1 digest- Parameters:
connectionName- The Martini Runtime Redis connection pool namedigest- sHA1 of the scripttype- the typekeys- the keys- Returns:
- script result
-
evalshaAsync
@GloopParameter(name="redisFutureEvalshaOutput") public static <T> Future<T> evalshaAsync(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) String digest, @GloopParameter(allowNull=false,choices={"BOOLEAN","INTEGER","MULTI","STATUS","VALUE"}) String type, @GloopParameter(allowNull=false) Object[] keys, GloopExecutionContext context, @GloopParameter(allowNull=false) Object... values) Asynchronously execute a lua script server side.- Parameters:
connectionName- The Martini Runtime Redis connection pool namedigest- sHA1 of the scripttype- the typekeys- the keysvalues- the values- Returns:
- script result
-
scriptExists
@GloopParameter(name="redisScriptExistsOutput") public static List<Boolean> scriptExists(@GloopParameter(allowNull=false) String connectionName, GloopExecutionContext context, @GloopParameter(allowNull=false) String... digests) Check existence of scripts in the script cache.- Parameters:
connectionName- The Martini Runtime Redis connection pool namedigests- script digests- Returns:
- List<Boolean> array-reply The command returns an array of integers that correspond to the specified SHA1 digest arguments. For every corresponding SHA1 digest of a script that actually exists in the script cache, an 1 is returned, otherwise 0 is returned.
-
scriptExistsAsync
@GloopParameter(name="redisFutureScriptExistsOutput") public static Future<List<Boolean>> scriptExistsAsync(@GloopParameter(allowNull=false) String connectionName, GloopExecutionContext context, @GloopParameter(allowNull=false) String... digests) Asynchronously check existence of scripts in the script cache.- Parameters:
connectionName- The Martini Runtime Redis connection pool namedigests- script digests- Returns:
- list<Boolean> array-reply the command returns an array of integers that correspond to the specified sHA1 digest arguments. for every corresponding sHA1 digest of a script that actually exists in the script cache, an 1 is returned, otherwise 0 is returned.
-
scriptFlush
@GloopParameter(name="redisScriptFlushOutput") public static String scriptFlush(@GloopParameter(allowNull=false) String connectionName, GloopExecutionContext context) Remove all the scripts from the script cache.- Parameters:
connectionName- The Martini Runtime Redis connection pool name- Returns:
- String simple-string-reply
-
scriptFlushAsync
@GloopParameter(name="redisFutureScriptFlushOutput") public static Future<String> scriptFlushAsync(@GloopParameter(allowNull=false) String connectionName, GloopExecutionContext context) Asynchronously remove all the scripts from the script cache.- Parameters:
connectionName- The Martini Runtime Redis connection pool name- Returns:
- string simple-string-reply
-
scriptKill
@GloopParameter(name="redisScriptKillOutput") public static String scriptKill(@GloopParameter(allowNull=false) String connectionName, GloopExecutionContext context) Kill the script currently in execution.- Parameters:
connectionName- The Martini Runtime Redis connection pool name- Returns:
- String simple-string-reply
-
scriptKillAsync
@GloopParameter(name="redisFutureScriptKillOutput") public static Future<String> scriptKillAsync(@GloopParameter(allowNull=false) String connectionName, GloopExecutionContext context) Asynchronously kill the script currently in execution.- Parameters:
connectionName- The Martini Runtime Redis connection pool name- Returns:
- string simple-string-reply
-
scriptLoad
@GloopParameter(name="redisScriptLoadOutput") public static String scriptLoad(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) Object script, GloopExecutionContext context) Load the specified Lua script into the script cache.- Parameters:
connectionName- The Martini Runtime Redis connection pool namescript- script content- Returns:
- String bulk-string-reply This command returns the SHA1 digest of the script added into the script cache.
-
scriptLoadAsync
@GloopParameter(name="redisFutureScriptLoadOutput") public static Future<String> scriptLoadAsync(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) Object script, GloopExecutionContext context) Asynchronously load the specified lua script into the script cache.- Parameters:
connectionName- The Martini Runtime Redis connection pool namescript- script content- Returns:
- string bulk-string-reply this command returns the sHA1 digest of the script added into the script cache.
-
digest
@GloopParameter(name="redisDigestOutput") public static String digest(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) Object script, GloopExecutionContext context) Create a SHA1 digest from a Lua script.- Parameters:
connectionName- The Martini Runtime Redis connection pool namescript- script content- Returns:
- the SHA1 value
-
digestAsync
@GloopParameter(name="redisFutureDigestOutput") public static String digestAsync(@GloopParameter(allowNull=false) String connectionName, @GloopParameter(allowNull=false) Object script, GloopExecutionContext context) Asynchronously create a SHA1 digest from a lua script.- Parameters:
connectionName- The Martini Runtime Redis connection pool namescript- script content- Returns:
- the sHA1 value
-