RObject
, RObjectAsync
JCache
, RedissonAtomicDouble
, RedissonAtomicLong
, RedissonBaseAdder
, RedissonBitSet
, RedissonBloomFilter
, RedissonBucket
, RedissonCountDownLatch
, RedissonDelayedQueue
, RedissonHyperLogLog
, RedissonList
, RedissonListMultimapValues
, RedissonLock
, RedissonMap
, RedissonMultimap
, RedissonPermitExpirableSemaphore
, RedissonRateLimiter
, RedissonReadWriteLock
, RedissonScoredSortedSet
, RedissonSemaphore
, RedissonSet
, RedissonSetCache
, RedissonSetMultimapValues
, RedissonSortedSet
, RedissonStream
public abstract class RedissonObject extends Object implements RObject
Modifier and Type | Field | Description |
---|---|---|
protected Codec |
codec |
|
protected CommandAsyncExecutor |
commandExecutor |
Constructor | Description |
---|---|
RedissonObject(Codec codec,
CommandAsyncExecutor commandExecutor,
String name) |
|
RedissonObject(CommandAsyncExecutor commandExecutor,
String name) |
Modifier and Type | Method | Description |
---|---|---|
protected boolean |
await(RFuture<?> future,
long timeout,
TimeUnit timeoutUnit) |
|
void |
copy(String host,
int port,
int database,
long timeout) |
Copy object from source Redis instance to destination Redis instance
|
RFuture<Void> |
copyAsync(String host,
int port,
int database,
long timeout) |
Copy object from source Redis instance to destination Redis instance
in async mode
|
boolean |
delete() |
Deletes the object
|
RFuture<Boolean> |
deleteAsync() |
Delete object in async mode
|
byte[] |
dump() |
Returns dump of object
|
RFuture<byte[]> |
dumpAsync() |
Returns dump of object
|
io.netty.buffer.ByteBuf |
encode(Object value) |
|
protected List<io.netty.buffer.ByteBuf> |
encode(Collection<?> values) |
|
protected void |
encode(Collection<Object> params,
Collection<?> values) |
|
io.netty.buffer.ByteBuf |
encodeMapKey(Object value) |
|
protected void |
encodeMapKeys(Collection<Object> params,
Collection<?> values) |
|
io.netty.buffer.ByteBuf |
encodeMapValue(Object value) |
|
protected void |
encodeMapValues(Collection<Object> params,
Collection<?> values) |
|
protected <V> V |
get(RFuture<V> future) |
|
Codec |
getCodec() |
Returns the underlying Codec used by this RObject
|
String |
getName() |
Returns name of object
|
protected String |
getName(Object o) |
|
boolean |
isExists() |
Check object existence
|
RFuture<Boolean> |
isExistsAsync() |
Check object existence in async mode.
|
void |
migrate(String host,
int port,
int database,
long timeout) |
Copy object from source Redis instance to destination Redis instance
|
RFuture<Void> |
migrateAsync(String host,
int port,
int database,
long timeout) |
Transfer object from source Redis instance to destination Redis instance
in async mode
|
boolean |
move(int database) |
Move object to another database
|
RFuture<Boolean> |
moveAsync(int database) |
Move object to another database in async mode
|
static String |
prefixName(String prefix,
String name) |
|
void |
rename(String newName) |
Rename current object key to
newName |
RFuture<Void> |
renameAsync(String newName) |
Rename current object key to
newName
in async mode |
boolean |
renamenx(String newName) |
Rename current object key to
newName
only if new key is not exists |
RFuture<Boolean> |
renamenxAsync(String newName) |
Rename current object key to
newName
in async mode only if new key is not exists |
void |
restore(byte[] state) |
Restores object using its state returned by
RObject.dump() method. |
void |
restore(byte[] state,
long timeToLive,
TimeUnit timeUnit) |
Restores object using its state returned by
RObject.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.
|
RFuture<Void> |
restoreAndReplaceAsync(byte[] state) |
Restores and replaces object if it already exists.
|
RFuture<Void> |
restoreAndReplaceAsync(byte[] state,
long timeToLive,
TimeUnit timeUnit) |
Restores and replaces object if it already exists and set time to live for it.
|
RFuture<Void> |
restoreAsync(byte[] state) |
Restores object using its state returned by
RObjectAsync.dumpAsync() method. |
RFuture<Void> |
restoreAsync(byte[] state,
long timeToLive,
TimeUnit timeUnit) |
Restores object using its state returned by
RObjectAsync.dumpAsync() method and set time to live for it. |
static String |
suffixName(String name,
String suffix) |
|
protected long |
toSeconds(long timeout,
TimeUnit unit) |
|
boolean |
touch() |
Update the last access time of an object.
|
RFuture<Boolean> |
touchAsync() |
Update the last access time of an object in async mode.
|
boolean |
unlink() |
Delete the objects.
|
RFuture<Boolean> |
unlinkAsync() |
Delete the objects.
|
protected final CommandAsyncExecutor commandExecutor
protected final Codec codec
public RedissonObject(Codec codec, CommandAsyncExecutor commandExecutor, String name)
public RedissonObject(CommandAsyncExecutor commandExecutor, String name)
protected boolean await(RFuture<?> future, long timeout, TimeUnit timeoutUnit) throws InterruptedException
InterruptedException
protected final <V> V get(RFuture<V> future)
protected final long toSeconds(long timeout, TimeUnit unit)
public void rename(String newName)
RObject
newName
public RFuture<Void> renameAsync(String newName)
RObjectAsync
newName
in async moderenameAsync
in interface RObjectAsync
newName
- - new name of objectpublic void migrate(String host, int port, int database, long timeout)
RObject
public RFuture<Void> migrateAsync(String host, int port, int database, long timeout)
RObjectAsync
migrateAsync
in interface RObjectAsync
host
- - destination hostport
- - destination portdatabase
- - destination databasetimeout
- - maximum idle time in any moment of the communication with the destination instance in millisecondspublic void copy(String host, int port, int database, long timeout)
RObject
public RFuture<Void> copyAsync(String host, int port, int database, long timeout)
RObjectAsync
copyAsync
in interface RObjectAsync
host
- - destination hostport
- - destination portdatabase
- - destination databasetimeout
- - maximum idle time in any moment of the communication with the destination instance in millisecondspublic boolean move(int database)
RObject
public RFuture<Boolean> moveAsync(int database)
RObjectAsync
moveAsync
in interface RObjectAsync
database
- - number of Redis databasetrue
if key was moved false
if notpublic boolean renamenx(String newName)
RObject
newName
only if new key is not existspublic RFuture<Boolean> renamenxAsync(String newName)
RObjectAsync
newName
in async mode only if new key is not existsrenamenxAsync
in interface RObjectAsync
newName
- - new name of objecttrue
if object has been renamed successfully and false
otherwisepublic boolean delete()
RObject
public RFuture<Boolean> deleteAsync()
RObjectAsync
deleteAsync
in interface RObjectAsync
true
if object was deleted false
if notpublic boolean unlink()
RObject
Requires Redis 4.0+
public RFuture<Boolean> unlinkAsync()
RObjectAsync
Requires Redis 4.0+
unlinkAsync
in interface RObjectAsync
true
if it was exist and deleted else false
public boolean touch()
RObject
public RFuture<Boolean> touchAsync()
RObjectAsync
touchAsync
in interface RObjectAsync
true
if object was touched else false
public boolean isExists()
RObject
public RFuture<Boolean> isExistsAsync()
RObjectAsync
isExistsAsync
in interface RObjectAsync
true
if object exists and false
otherwisepublic Codec getCodec()
RObject
protected List<io.netty.buffer.ByteBuf> encode(Collection<?> values)
protected void encode(Collection<Object> params, Collection<?> values)
protected void encodeMapKeys(Collection<Object> params, Collection<?> values)
protected void encodeMapValues(Collection<Object> params, Collection<?> values)
public io.netty.buffer.ByteBuf encode(Object value)
public io.netty.buffer.ByteBuf encodeMapKey(Object value)
public io.netty.buffer.ByteBuf encodeMapValue(Object value)
public byte[] dump()
RObject
public RFuture<byte[]> dumpAsync()
RObjectAsync
dumpAsync
in interface RObjectAsync
public void restore(byte[] state)
RObject
RObject.dump()
method.public RFuture<Void> restoreAsync(byte[] state)
RObjectAsync
RObjectAsync.dumpAsync()
method.restoreAsync
in interface RObjectAsync
state
- - state of objectpublic void restore(byte[] state, long timeToLive, TimeUnit timeUnit)
RObject
RObject.dump()
method and set time to live for it.public RFuture<Void> restoreAsync(byte[] state, long timeToLive, TimeUnit timeUnit)
RObjectAsync
RObjectAsync.dumpAsync()
method and set time to live for it.restoreAsync
in interface RObjectAsync
state
- - state of objecttimeToLive
- - time to live of the objecttimeUnit
- - time unitpublic void restoreAndReplace(byte[] state, long timeToLive, TimeUnit timeUnit)
RObject
restoreAndReplace
in interface RObject
state
- - state of the objecttimeToLive
- - time to live of the objecttimeUnit
- - time unitpublic RFuture<Void> restoreAndReplaceAsync(byte[] state, long timeToLive, TimeUnit timeUnit)
RObjectAsync
restoreAndReplaceAsync
in interface RObjectAsync
state
- - state of the objecttimeToLive
- - time to live of the objecttimeUnit
- - time unitpublic void restoreAndReplace(byte[] state)
RObject
restoreAndReplace
in interface RObject
state
- - state of the objectpublic RFuture<Void> restoreAndReplaceAsync(byte[] state)
RObjectAsync
restoreAndReplaceAsync
in interface RObjectAsync
state
- - state of the objectCopyright © 2014–2018 The Redisson Project. All rights reserved.