public interface RObject extends RObjectAsync
| Modifier and Type | Method and Description |
|---|---|
int |
addListener(ObjectListener listener)
Adds object event listener
|
void |
copy(String host,
int port,
int database,
long timeout)
Copy object from source Redis instance to destination Redis instance
|
boolean |
delete()
Deletes the object
|
byte[] |
dump()
Returns dump of object
|
Codec |
getCodec()
Returns the underlying Codec used by this RObject
|
Long |
getIdleTime()
Returns number of seconds spent since last write or read operation over this object.
|
String |
getName()
Returns name of object
|
boolean |
isExists()
Check object existence
|
void |
migrate(String host,
int port,
int database,
long timeout)
Copy object from source Redis instance to destination Redis instance
|
boolean |
move(int database)
Move object to another database
|
void |
removeListener(int listenerId)
Removes object event listener
|
void |
rename(String newName)
Rename current object key to
newName |
boolean |
renamenx(String newName)
Rename current object key to
newName
only if new key is not exists |
void |
restore(byte[] state)
Restores object using its state returned by
dump() method. |
void |
restore(byte[] state,
long timeToLive,
TimeUnit timeUnit)
Restores object using its state returned by
dump() method and set time to live for it. |
void |
restoreAndReplace(byte[] state)
Restores and replaces object if it already exists.
|
void |
restoreAndReplace(byte[] state,
long timeToLive,
TimeUnit timeUnit)
Restores and replaces object if it already exists and set time to live for it.
|
long |
sizeInMemory()
Returns bytes amount used by object in Redis memory.
|
boolean |
touch()
Update the last access time of an object.
|
boolean |
unlink()
Delete the objects.
|
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsyncLong getIdleTime()
long sizeInMemory()
void restore(byte[] state)
dump() method.state - - state of objectvoid restore(byte[] state,
long timeToLive,
TimeUnit timeUnit)
dump() method and set time to live for it.state - - state of objecttimeToLive - - time to live of the objecttimeUnit - - time unitvoid restoreAndReplace(byte[] state)
state - - state of the objectvoid restoreAndReplace(byte[] state,
long timeToLive,
TimeUnit timeUnit)
state - - state of the objecttimeToLive - - time to live of the objecttimeUnit - - time unitbyte[] dump()
boolean touch()
true if object was touched else falsevoid migrate(String host, int port, int database, long timeout)
host - - destination hostport - - destination portdatabase - - destination databasetimeout - - maximum idle time in any moment of the communication with the destination instance in millisecondsvoid copy(String host, int port, int database, long timeout)
host - - destination hostport - - destination portdatabase - - destination databasetimeout - - maximum idle time in any moment of the communication with the destination instance in millisecondsboolean move(int database)
database - - Redis database numbertrue if key was moved else falseString getName()
boolean delete()
true if it was exist and deleted else falseboolean unlink()
Requires Redis 4.0+
true if it was exist and deleted else falsevoid rename(String newName)
newNamenewName - - new name of objectboolean renamenx(String newName)
newName
only if new key is not existsnewName - - new name of objecttrue if object has been renamed successfully and false otherwiseboolean isExists()
true if object exists and false otherwiseCodec getCodec()
int addListener(ObjectListener listener)
listener - - object event listenerExpiredObjectListener,
DeletedObjectListenervoid removeListener(int listenerId)
listenerId - - listener idCopyright © 2014–2021 Redisson. All rights reserved.