Package org.redisson
Class RedissonFuction
- java.lang.Object
-
- org.redisson.RedissonFuction
-
- All Implemented Interfaces:
RFunction
,RFunctionAsync
public class RedissonFuction extends Object implements RFunction
- Author:
- Nikita Koksharov
-
-
Constructor Summary
Constructors Constructor Description RedissonFuction(CommandAsyncExecutor commandExecutor)
RedissonFuction(CommandAsyncExecutor commandExecutor, Codec codec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> R
call(String key, FunctionMode mode, String name, FunctionResult returnType, List<Object> keys, Object... values)
Executes function<R> R
call(FunctionMode mode, String name, FunctionResult returnType)
Executes function<R> R
call(FunctionMode mode, String name, FunctionResult returnType, List<Object> keys, Object... values)
Executes function<R> RFuture<R>
callAsync(String key, FunctionMode mode, String name, FunctionResult returnType, List<Object> keys, Object... values)
Executes function<R> RFuture<R>
callAsync(FunctionMode mode, String name, FunctionResult returnType)
Executes function<R> RFuture<R>
callAsync(FunctionMode mode, String name, FunctionResult returnType, List<Object> keys, Object... values)
Executes functionvoid
delete(String libraryName)
Deletes library.RFuture<Void>
deleteAsync(String libraryName)
Deletes library.byte[]
dump()
Returns serialized state of all libraries.RFuture<byte[]>
dumpAsync()
Returns serialized state of all libraries.void
flush()
Deletes all libraries.RFuture<Void>
flushAsync()
Deletes all libraries.void
kill()
Kills currently executed functions.RFuture<Void>
killAsync()
Kills currently executed functions.List<FunctionLibrary>
list()
Returns information about libraries and functions per each.List<FunctionLibrary>
list(String namePattern)
Returns information about libraries and functions per each by name pattern.RFuture<List<FunctionLibrary>>
listAsync()
Returns information about libraries and functions per each.RFuture<List<FunctionLibrary>>
listAsync(String namePattern)
Returns information about libraries and functions per each by name pattern.void
load(String libraryName, String code)
Loads a library.void
loadAndReplace(String libraryName, String code)
Loads a library and overwrites existing library.RFuture<Void>
loadAndReplaceAsync(String libraryName, String code)
Loads a library and overwrites existing library.RFuture<Void>
loadAsync(String libraryName, String code)
Loads a library.void
restore(byte[] payload)
Restores libraries using their state returned byRFunction.dump()
method.void
restoreAfterFlush(byte[] payload)
Restores libraries using their state returned byRFunction.dump()
method.RFuture<Void>
restoreAfterFlushAsync(byte[] payload)
Restores libraries using their state returned byRFunctionAsync.dumpAsync()
method.void
restoreAndReplace(byte[] payload)
Restores libraries using their state returned byRFunction.dump()
method.RFuture<Void>
restoreAndReplaceAsync(byte[] payload)
Restores libraries using their state returned byRFunctionAsync.dumpAsync()
method.RFuture<Void>
restoreAsync(byte[] payload)
Restores libraries using their state returned byRFunctionAsync.dumpAsync()
method.FunctionStats
stats()
Returns information about currently running Redis function and available execution engines.RFuture<FunctionStats>
statsAsync()
Returns information about currently running Redis function and available execution engines.
-
-
-
Constructor Detail
-
RedissonFuction
public RedissonFuction(CommandAsyncExecutor commandExecutor)
-
RedissonFuction
public RedissonFuction(CommandAsyncExecutor commandExecutor, Codec codec)
-
-
Method Detail
-
delete
public void delete(String libraryName)
Description copied from interface:RFunction
Deletes library. Error is thrown if library doesn't exist.
-
deleteAsync
public RFuture<Void> deleteAsync(String libraryName)
Description copied from interface:RFunctionAsync
Deletes library. Error is thrown if library doesn't exist.- Specified by:
deleteAsync
in interfaceRFunctionAsync
- Parameters:
libraryName
- library name
-
dump
public byte[] dump()
Description copied from interface:RFunction
Returns serialized state of all libraries.
-
dumpAsync
public RFuture<byte[]> dumpAsync()
Description copied from interface:RFunctionAsync
Returns serialized state of all libraries.- Specified by:
dumpAsync
in interfaceRFunctionAsync
- Returns:
- serialized state
-
flush
public void flush()
Description copied from interface:RFunction
Deletes all libraries.
-
flushAsync
public RFuture<Void> flushAsync()
Description copied from interface:RFunctionAsync
Deletes all libraries.- Specified by:
flushAsync
in interfaceRFunctionAsync
-
kill
public void kill()
Description copied from interface:RFunction
Kills currently executed functions. Applied only to functions which don't modify data.
-
killAsync
public RFuture<Void> killAsync()
Description copied from interface:RFunctionAsync
Kills currently executed functions. Applied only to functions which don't modify data.- Specified by:
killAsync
in interfaceRFunctionAsync
-
list
public List<FunctionLibrary> list()
Description copied from interface:RFunction
Returns information about libraries and functions per each.
-
listAsync
public RFuture<List<FunctionLibrary>> listAsync()
Description copied from interface:RFunctionAsync
Returns information about libraries and functions per each.- Specified by:
listAsync
in interfaceRFunctionAsync
- Returns:
- list of libraries
-
list
public List<FunctionLibrary> list(String namePattern)
Description copied from interface:RFunction
Returns information about libraries and functions per each by name pattern.Supported glob-style patterns: h?llo matches hello, hallo and hxllo h*llo matches hllo and heeeello h[ae]llo matches hello and hallo, but not hillo
-
listAsync
public RFuture<List<FunctionLibrary>> listAsync(String namePattern)
Description copied from interface:RFunctionAsync
Returns information about libraries and functions per each by name pattern.Supported glob-style patterns: h?llo matches hello, hallo and hxllo h*llo matches hllo and heeeello h[ae]llo matches hello and hallo, but not hillo
- Specified by:
listAsync
in interfaceRFunctionAsync
- Parameters:
namePattern
- name pattern- Returns:
- list of libraries
-
load
public void load(String libraryName, String code)
Description copied from interface:RFunction
Loads a library. Error is thrown if library already exists.
-
loadAsync
public RFuture<Void> loadAsync(String libraryName, String code)
Description copied from interface:RFunctionAsync
Loads a library. Error is thrown if library already exists.- Specified by:
loadAsync
in interfaceRFunctionAsync
- Parameters:
libraryName
- library namecode
- function code
-
loadAndReplace
public void loadAndReplace(String libraryName, String code)
Description copied from interface:RFunction
Loads a library and overwrites existing library.- Specified by:
loadAndReplace
in interfaceRFunction
- Parameters:
libraryName
- library namecode
- function code
-
loadAndReplaceAsync
public RFuture<Void> loadAndReplaceAsync(String libraryName, String code)
Description copied from interface:RFunctionAsync
Loads a library and overwrites existing library.- Specified by:
loadAndReplaceAsync
in interfaceRFunctionAsync
- Parameters:
libraryName
- library namecode
- function code
-
restore
public void restore(byte[] payload)
Description copied from interface:RFunction
Restores libraries using their state returned byRFunction.dump()
method. Restored libraries are appended to the existing libraries and throws error in case of collision.
-
restoreAsync
public RFuture<Void> restoreAsync(byte[] payload)
Description copied from interface:RFunctionAsync
Restores libraries using their state returned byRFunctionAsync.dumpAsync()
method. Restored libraries are appended to the existing libraries and throws error in case of collision.- Specified by:
restoreAsync
in interfaceRFunctionAsync
- Parameters:
payload
- serialized state
-
restoreAndReplace
public void restoreAndReplace(byte[] payload)
Description copied from interface:RFunction
Restores libraries using their state returned byRFunction.dump()
method. Restored libraries are appended to the existing libraries.- Specified by:
restoreAndReplace
in interfaceRFunction
- Parameters:
payload
- serialized state
-
restoreAndReplaceAsync
public RFuture<Void> restoreAndReplaceAsync(byte[] payload)
Description copied from interface:RFunctionAsync
Restores libraries using their state returned byRFunctionAsync.dumpAsync()
method. Restored libraries are appended to the existing libraries.- Specified by:
restoreAndReplaceAsync
in interfaceRFunctionAsync
- Parameters:
payload
- serialized state
-
restoreAfterFlush
public void restoreAfterFlush(byte[] payload)
Description copied from interface:RFunction
Restores libraries using their state returned byRFunction.dump()
method. Deletes all existing libraries before restoring.- Specified by:
restoreAfterFlush
in interfaceRFunction
- Parameters:
payload
- serialized state
-
restoreAfterFlushAsync
public RFuture<Void> restoreAfterFlushAsync(byte[] payload)
Description copied from interface:RFunctionAsync
Restores libraries using their state returned byRFunctionAsync.dumpAsync()
method. Deletes all existing libraries before restoring.- Specified by:
restoreAfterFlushAsync
in interfaceRFunctionAsync
- Parameters:
payload
- serialized state
-
call
public <R> R call(String key, FunctionMode mode, String name, FunctionResult returnType, List<Object> keys, Object... values)
Description copied from interface:RFunction
Executes function- Specified by:
call
in interfaceRFunction
- Type Parameters:
R
- - type of result- Parameters:
key
- - used to locate Redis node in Clustermode
- - execution modename
- - function namereturnType
- - return typekeys
- - keys available through KEYS param in scriptvalues
- - values available through VALUES param in script- Returns:
- result object
-
call
public <R> R call(FunctionMode mode, String name, FunctionResult returnType, List<Object> keys, Object... values)
Description copied from interface:RFunction
Executes function- Specified by:
call
in interfaceRFunction
- Type Parameters:
R
- - type of result- Parameters:
mode
- - execution modename
- - function namereturnType
- - return typekeys
- - keys available through KEYS param in scriptvalues
- - values available through VALUES param in script- Returns:
- result object
-
call
public <R> R call(FunctionMode mode, String name, FunctionResult returnType)
Description copied from interface:RFunction
Executes function
-
stats
public FunctionStats stats()
Description copied from interface:RFunction
Returns information about currently running Redis function and available execution engines.
-
statsAsync
public RFuture<FunctionStats> statsAsync()
Description copied from interface:RFunctionAsync
Returns information about currently running Redis function and available execution engines.- Specified by:
statsAsync
in interfaceRFunctionAsync
- Returns:
- function information
-
callAsync
public <R> RFuture<R> callAsync(String key, FunctionMode mode, String name, FunctionResult returnType, List<Object> keys, Object... values)
Description copied from interface:RFunctionAsync
Executes function- Specified by:
callAsync
in interfaceRFunctionAsync
- Type Parameters:
R
- - type of result- Parameters:
key
- - used to locate Redis node in Cluster which stores cached Lua scriptmode
- - execution modename
- - function namereturnType
- - return typekeys
- - keys available through KEYS param in scriptvalues
- - values available through VALUES param in script- Returns:
- result object
-
callAsync
public <R> RFuture<R> callAsync(FunctionMode mode, String name, FunctionResult returnType, List<Object> keys, Object... values)
Description copied from interface:RFunctionAsync
Executes function- Specified by:
callAsync
in interfaceRFunctionAsync
- Type Parameters:
R
- - type of result- Parameters:
mode
- - execution modename
- - function namereturnType
- - return typekeys
- - keys available through KEYS param in scriptvalues
- - values available through VALUES param in script- Returns:
- result object
-
callAsync
public <R> RFuture<R> callAsync(FunctionMode mode, String name, FunctionResult returnType)
Description copied from interface:RFunctionAsync
Executes function- Specified by:
callAsync
in interfaceRFunctionAsync
- Type Parameters:
R
- - type of result- Parameters:
mode
- - execution modename
- - function namereturnType
- - return type- Returns:
- result object
-
-