Package org.redisson
Class RedissonObject
java.lang.Object
org.redisson.RedissonObject
- All Implemented Interfaces:
RObject,RObjectAsync
- Direct Known Subclasses:
JCache,RedissonAtomicDouble,RedissonAtomicLong,RedissonBaseAdder,RedissonBaseLock,RedissonBitSet,RedissonBloomFilter,RedissonBucket,RedissonCountDownLatch,RedissonDelayedQueue,RedissonHyperLogLog,RedissonIdGenerator,RedissonJsonBucket,RedissonList,RedissonListMultimapValues,RedissonMap,RedissonMultimap,RedissonPermitExpirableSemaphore,RedissonRateLimiter,RedissonReadWriteLock,RedissonReliableTopic,RedissonScoredSortedSet,RedissonSemaphore,RedissonSet,RedissonSetCache,RedissonSetMultimapValues,RedissonSortedSet,RedissonStream,RedissonTimeSeries,RedissonTransferQueue
Base Redisson object
- Author:
- Nikita Koksharov
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Codecprotected final CommandAsyncExecutorprotected String -
Constructor Summary
ConstructorsConstructorDescriptionRedissonObject(Codec codec, CommandAsyncExecutor commandExecutor, String name) RedissonObject(CommandAsyncExecutor commandExecutor, String name) -
Method Summary
Modifier and TypeMethodDescriptionprotected final <T extends ObjectListener>
intaddListener(String name, T listener, BiConsumer<T, String> consumer) intaddListener(ObjectListener listener) Adds object event listenerprotected final <T extends ObjectListener>
RFuture<Integer>addListenerAsync(String name, T listener, BiConsumer<T, String> consumer) addListenerAsync(ObjectListener listener) Adds object event listenervoidCopy object from source Redis instance to destination Redis instanceCopy object from source Redis instance to destination Redis instance in async modebooleandelete()Deletes the objectDelete object in async modedeleteAsync(String... keys) byte[]dump()Returns dump of objectRFuture<byte[]>Returns dump of objectio.netty.buffer.ByteBufprotected List<io.netty.buffer.ByteBuf>encode(Collection<?> values) voidencode(Collection<?> params, Object value) voidencode(Collection<Object> params, Collection<?> values) io.netty.buffer.ByteBufencodeMapKey(Object value) io.netty.buffer.ByteBufencodeMapKey(Object value, Collection<Object> params) protected voidencodeMapKeys(Collection<Object> params, Collection<?> values) io.netty.buffer.ByteBufencodeMapValue(Object value) protected voidencodeMapValues(Collection<Object> params, Collection<?> values) protected final <V> VgetCodec()Returns the underlying Codec used by this RObjectReturns number of seconds spent since last write or read operation over this object.Returns number of seconds spent since last write or read operation over this object.getLockByMapKey(Object key, String suffix) getLockByValue(Object key, String suffix) getName()Returns name of objectfinal Stringprotected StringgetRawName(Object o) booleanisExists()Check object existenceCheck object existence in async mode.voidCopy object from source Redis instance to destination Redis instancemigrateAsync(String host, int port, int database, long timeout) Transfer object from source Redis instance to destination Redis instance in async modebooleanmove(int database) Move object to another databasemoveAsync(int database) Move object to another database in async modestatic StringprefixName(String prefix, String name) voidremoveListener(int listenerId) Removes object event listenerremoveListenerAsync(int listenerId) Removes object event listenervoidRename current object key tonewNamerenameAsync(String newName) Rename current object key tonewNamein async modebooleanRename current object key tonewNameonly if new key is not existsrenamenxAsync(String newName) Rename current object key tonewNamein async mode only if new key is not existsvoidrestore(byte[] state) Restores object using its state returned byRObject.dump()method.voidRestores object using its state returned byRObject.dump()method and set time to live for it.voidrestoreAndReplace(byte[] state) Restores and replaces object if it already exists.voidrestoreAndReplace(byte[] state, long timeToLive, TimeUnit timeUnit) Restores and replaces object if it already exists and set time to live for it.restoreAndReplaceAsync(byte[] state) Restores and replaces object if it already exists.restoreAndReplaceAsync(byte[] state, long timeToLive, TimeUnit timeUnit) Restores and replaces object if it already exists and set time to live for it.restoreAsync(byte[] state) Restores object using its state returned byRObjectAsync.dumpAsync()method.restoreAsync(byte[] state, long timeToLive, TimeUnit timeUnit) Restores object using its state returned byRObjectAsync.dumpAsync()method and set time to live for it.protected final voidlongReturns bytes amount used by object in Redis memory.Returns bytes amount used by object in Redis memory.sizeInMemoryAsync(List<Object> keys) sizeInMemoryAsync(CommandAsyncExecutor commandExecutor, List<Object> keys) static StringsuffixName(String name, String suffix) protected final longprotected final <T> Stream<T>booleantouch()Update the last access time of an object.Update the last access time of an object in async mode.booleanunlink()Delete the objects.Delete the objects.
-
Field Details
-
commandExecutor
-
name
-
codec
-
-
Constructor Details
-
RedissonObject
-
RedissonObject
-
-
Method Details
-
prefixName
-
suffixName
-
toStream
-
get
-
toSeconds
-
getName
Description copied from interface:RObjectReturns name of object -
getRawName
-
getRawName
-
setName
-
rename
Description copied from interface:RObjectRename current object key tonewName -
sizeInMemoryAsync
Description copied from interface:RObjectAsyncReturns bytes amount used by object in Redis memory.- Specified by:
sizeInMemoryAsyncin interfaceRObjectAsync- Returns:
- size in bytes
-
sizeInMemoryAsync
-
sizeInMemoryAsync
public final RFuture<Long> sizeInMemoryAsync(CommandAsyncExecutor commandExecutor, List<Object> keys) -
sizeInMemory
public long sizeInMemory()Description copied from interface:RObjectReturns bytes amount used by object in Redis memory.- Specified by:
sizeInMemoryin interfaceRObject- Returns:
- size in bytes
-
renameAsync
Description copied from interface:RObjectAsyncRename current object key tonewNamein async mode- Specified by:
renameAsyncin interfaceRObjectAsync- Parameters:
newName- - new name of object- Returns:
- void
-
migrate
Description copied from interface:RObjectCopy object from source Redis instance to destination Redis instance -
migrateAsync
Description copied from interface:RObjectAsyncTransfer object from source Redis instance to destination Redis instance in async mode- Specified by:
migrateAsyncin interfaceRObjectAsync- Parameters:
host- - destination hostport- - destination portdatabase- - destination databasetimeout- - maximum idle time in any moment of the communication with the destination instance in milliseconds- Returns:
- void
-
copy
Description copied from interface:RObjectCopy object from source Redis instance to destination Redis instance -
copyAsync
Description copied from interface:RObjectAsyncCopy object from source Redis instance to destination Redis instance in async mode- Specified by:
copyAsyncin interfaceRObjectAsync- Parameters:
host- - destination hostport- - destination portdatabase- - destination databasetimeout- - maximum idle time in any moment of the communication with the destination instance in milliseconds- Returns:
- void
-
move
public boolean move(int database) Description copied from interface:RObjectMove object to another database -
moveAsync
Description copied from interface:RObjectAsyncMove object to another database in async mode- Specified by:
moveAsyncin interfaceRObjectAsync- Parameters:
database- - number of Redis database- Returns:
trueif key was movedfalseif not
-
renamenx
Description copied from interface:RObjectRename current object key tonewNameonly if new key is not exists -
renamenxAsync
Description copied from interface:RObjectAsyncRename current object key tonewNamein async mode only if new key is not exists- Specified by:
renamenxAsyncin interfaceRObjectAsync- Parameters:
newName- - new name of object- Returns:
trueif object has been renamed successfully andfalseotherwise
-
delete
public boolean delete()Description copied from interface:RObjectDeletes the object -
deleteAsync
Description copied from interface:RObjectAsyncDelete object in async mode- Specified by:
deleteAsyncin interfaceRObjectAsync- Returns:
trueif object was deletedfalseif not
-
deleteAsync
-
unlink
public boolean unlink()Description copied from interface:RObjectDelete the objects. Actual removal will happen later asynchronously.Requires Redis 4.0+
-
unlinkAsync
Description copied from interface:RObjectAsyncDelete the objects. Actual removal will happen later asynchronously.Requires Redis 4.0+
- Specified by:
unlinkAsyncin interfaceRObjectAsync- Returns:
trueif it was exist and deleted elsefalse
-
touch
public boolean touch()Description copied from interface:RObjectUpdate the last access time of an object. -
touchAsync
Description copied from interface:RObjectAsyncUpdate the last access time of an object in async mode.- Specified by:
touchAsyncin interfaceRObjectAsync- Returns:
trueif object was touched elsefalse
-
isExists
public boolean isExists()Description copied from interface:RObjectCheck object existence -
isExistsAsync
Description copied from interface:RObjectAsyncCheck object existence in async mode.- Specified by:
isExistsAsyncin interfaceRObjectAsync- Returns:
trueif object exists andfalseotherwise
-
getCodec
Description copied from interface:RObjectReturns the underlying Codec used by this RObject -
encode
-
encode
-
getLockByMapKey
-
getLockByValue
-
encodeMapKeys
-
encodeMapValues
-
encode
-
encode
-
encodeMapKey
-
encodeMapKey
-
encodeMapValue
-
dump
public byte[] dump()Description copied from interface:RObjectReturns dump of object -
dumpAsync
Description copied from interface:RObjectAsyncReturns dump of object- Specified by:
dumpAsyncin interfaceRObjectAsync- Returns:
- dump
-
restore
public void restore(byte[] state) Description copied from interface:RObjectRestores object using its state returned byRObject.dump()method. -
restoreAsync
Description copied from interface:RObjectAsyncRestores object using its state returned byRObjectAsync.dumpAsync()method.- Specified by:
restoreAsyncin interfaceRObjectAsync- Parameters:
state- - state of object- Returns:
- void
-
restore
Description copied from interface:RObjectRestores object using its state returned byRObject.dump()method and set time to live for it. -
restoreAsync
Description copied from interface:RObjectAsyncRestores object using its state returned byRObjectAsync.dumpAsync()method and set time to live for it.- Specified by:
restoreAsyncin interfaceRObjectAsync- Parameters:
state- - state of objecttimeToLive- - time to live of the objecttimeUnit- - time unit- Returns:
- void
-
restoreAndReplace
Description copied from interface:RObjectRestores and replaces object if it already exists and set time to live for it.- Specified by:
restoreAndReplacein interfaceRObject- Parameters:
state- - state of the objecttimeToLive- - time to live of the objecttimeUnit- - time unit
-
restoreAndReplaceAsync
Description copied from interface:RObjectAsyncRestores and replaces object if it already exists and set time to live for it.- Specified by:
restoreAndReplaceAsyncin interfaceRObjectAsync- Parameters:
state- - state of the objecttimeToLive- - time to live of the objecttimeUnit- - time unit- Returns:
- void
-
restoreAndReplace
public void restoreAndReplace(byte[] state) Description copied from interface:RObjectRestores and replaces object if it already exists.- Specified by:
restoreAndReplacein interfaceRObject- Parameters:
state- - state of the object
-
restoreAndReplaceAsync
Description copied from interface:RObjectAsyncRestores and replaces object if it already exists.- Specified by:
restoreAndReplaceAsyncin interfaceRObjectAsync- Parameters:
state- - state of the object- Returns:
- void
-
getIdleTime
Description copied from interface:RObjectReturns number of seconds spent since last write or read operation over this object.- Specified by:
getIdleTimein interfaceRObject- Returns:
- number of seconds
-
getIdleTimeAsync
Description copied from interface:RObjectAsyncReturns number of seconds spent since last write or read operation over this object.- Specified by:
getIdleTimeAsyncin interfaceRObjectAsync- Returns:
- number of seconds
-
addListener
protected final <T extends ObjectListener> int addListener(String name, T listener, BiConsumer<T, String> consumer) -
addListenerAsync
protected final <T extends ObjectListener> RFuture<Integer> addListenerAsync(String name, T listener, BiConsumer<T, String> consumer) -
addListener
Description copied from interface:RObjectAdds object event listener- Specified by:
addListenerin interfaceRObject- Parameters:
listener- - object event listener- Returns:
- listener id
- See Also:
-
addListenerAsync
Description copied from interface:RObjectAsyncAdds object event listener- Specified by:
addListenerAsyncin interfaceRObjectAsync- Parameters:
listener- - object event listener- Returns:
- listener id
- See Also:
-
removeListener
public void removeListener(int listenerId) Description copied from interface:RObjectRemoves object event listener- Specified by:
removeListenerin interfaceRObject- Parameters:
listenerId- - listener id
-
removeListenerAsync
Description copied from interface:RObjectAsyncRemoves object event listener- Specified by:
removeListenerAsyncin interfaceRObjectAsync- Parameters:
listenerId- - listener id
-