Package org.redisson.api
Interface RObject
- All Superinterfaces:
RObjectAsync
- All Known Subinterfaces:
RAtomicDouble,RAtomicLong,RBinaryStream,RBitSet,RBlockingDeque<V>,RBlockingQueue<V>,RBloomFilter<T>,RBoundedBlockingQueue<V>,RBucket<V>,RCountDownLatch,RDelayedQueue<V>,RDeque<V>,RDoubleAdder,RExpirable,RGeo<V>,RHyperLogLog<V>,RIdGenerator,RJsonBucket<V>,RLexSortedSet,RList<V>,RListMultimap<K,,V> RListMultimapCache<K,,V> RLiveObject,RLocalCachedMap<K,,V> RLongAdder,RMap<K,,V> RMapCache<K,,V> RMultimap<K,,V> RMultimapCache<K,,V> RPermitExpirableSemaphore,RPriorityBlockingDeque<V>,RPriorityBlockingQueue<V>,RPriorityDeque<V>,RPriorityQueue<V>,RQueue<V>,RRateLimiter,RReliableTopic,RRingBuffer<V>,RScoredSortedSet<V>,RSemaphore,RSet<V>,RSetCache<V>,RSetMultimap<K,,V> RSetMultimapCache<K,,V> RSortedSet<V>,RStream<K,,V> RTimeSeries<V,,L> RTransferQueue<V>
- All Known Implementing Classes:
ExpireAtOperation.RedissonBucketExtended,ExpireOperation.RedissonBucketExtended,JCache,RedissonAtomicDouble,RedissonAtomicLong,RedissonBaseAdder,RedissonBaseLock,RedissonBinaryStream,RedissonBitSet,RedissonBlockingDeque,RedissonBlockingQueue,RedissonBloomFilter,RedissonBoundedBlockingQueue,RedissonBucket,RedissonCountDownLatch,RedissonDelayedQueue,RedissonDeque,RedissonDoubleAdder,RedissonFairLock,RedissonFencedLock,RedissonGeo,RedissonHyperLogLog,RedissonIdGenerator,RedissonJsonBucket,RedissonLexSortedSet,RedissonList,RedissonListMultimap,RedissonListMultimapCache,RedissonListMultimapValues,RedissonLocalCachedMap,RedissonLock,RedissonLongAdder,RedissonMap,RedissonMapCache,RedissonMultimap,RedissonObject,RedissonPermitExpirableSemaphore,RedissonPriorityBlockingDeque,RedissonPriorityBlockingQueue,RedissonPriorityDeque,RedissonPriorityQueue,RedissonQueue,RedissonQueueSemaphore,RedissonRateLimiter,RedissonReadLock,RedissonReadWriteLock,RedissonReliableTopic,RedissonRingBuffer,RedissonScoredSortedSet,RedissonSemaphore,RedissonSet,RedissonSetCache,RedissonSetMultimap,RedissonSetMultimapCache,RedissonSetMultimapValues,RedissonSortedSet,RedissonSpinLock,RedissonStream,RedissonSubList,RedissonTimeSeries,RedissonTransactionalBucket,RedissonTransactionalLocalCachedMap,RedissonTransactionalLock,RedissonTransactionalMap,RedissonTransactionalMapCache,RedissonTransactionalReadLock,RedissonTransactionalSet,RedissonTransactionalSetCache,RedissonTransactionalWriteLock,RedissonTransferQueue,RedissonWriteLock
Base interface for all Redisson objects
- Author:
- Nikita Koksharov
-
Method Summary
Modifier and TypeMethodDescriptionintaddListener(ObjectListener listener) Adds object event listenervoidCopy object from source Redis instance to destination Redis instancebooleandelete()Deletes the objectbyte[]dump()Returns dump of objectgetCodec()Returns the underlying Codec used by this RObjectReturns number of seconds spent since last write or read operation over this object.getName()Returns name of objectbooleanisExists()Check object existencevoidCopy object from source Redis instance to destination Redis instancebooleanmove(int database) Move object to another databasevoidremoveListener(int listenerId) Removes object event listenervoidRename current object key tonewNamebooleanRename current object key tonewNameonly if new key is not existsvoidrestore(byte[] state) Restores object using its state returned bydump()method.voidRestores object using its state returned bydump()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.longReturns bytes amount used by object in Redis memory.booleantouch()Update the last access time of an object.booleanunlink()Delete the objects.Methods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
Method Details
-
getIdleTime
Long getIdleTime()Returns number of seconds spent since last write or read operation over this object.- Returns:
- number of seconds
-
sizeInMemory
long sizeInMemory()Returns bytes amount used by object in Redis memory.- Returns:
- size in bytes
-
restore
void restore(byte[] state) Restores object using its state returned bydump()method.- Parameters:
state- - state of object
-
restore
Restores object using its state returned bydump()method and set time to live for it.- Parameters:
state- - state of objecttimeToLive- - time to live of the objecttimeUnit- - time unit
-
restoreAndReplace
void restoreAndReplace(byte[] state) Restores and replaces object if it already exists.- Parameters:
state- - state of the object
-
restoreAndReplace
Restores and replaces object if it already exists and set time to live for it.- Parameters:
state- - state of the objecttimeToLive- - time to live of the objecttimeUnit- - time unit
-
dump
byte[] dump()Returns dump of object- Returns:
- dump
-
touch
boolean touch()Update the last access time of an object.- Returns:
trueif object was touched elsefalse
-
migrate
Copy object from source Redis instance to destination Redis instance- Parameters:
host- - destination hostport- - destination portdatabase- - destination databasetimeout- - maximum idle time in any moment of the communication with the destination instance in milliseconds
-
copy
Copy object from source Redis instance to destination Redis instance- Parameters:
host- - destination hostport- - destination portdatabase- - destination databasetimeout- - maximum idle time in any moment of the communication with the destination instance in milliseconds
-
move
boolean move(int database) Move object to another database- Parameters:
database- - Redis database number- Returns:
trueif key was moved elsefalse
-
getName
String getName()Returns name of object- Returns:
- name - name of object
-
delete
boolean delete()Deletes the object- Returns:
trueif it was exist and deleted elsefalse
-
unlink
boolean unlink()Delete the objects. Actual removal will happen later asynchronously.Requires Redis 4.0+
- Returns:
trueif it was exist and deleted elsefalse
-
rename
Rename current object key tonewName- Parameters:
newName- - new name of object
-
renamenx
Rename current object key tonewNameonly if new key is not exists- Parameters:
newName- - new name of object- Returns:
trueif object has been renamed successfully andfalseotherwise
-
isExists
boolean isExists()Check object existence- Returns:
trueif object exists andfalseotherwise
-
getCodec
Codec getCodec()Returns the underlying Codec used by this RObject- Returns:
- Codec of object
-
addListener
Adds object event listener- Parameters:
listener- - object event listener- Returns:
- listener id
- See Also:
-
removeListener
void removeListener(int listenerId) Removes object event listener- Parameters:
listenerId- - listener id
-