RObjectReactive
, RRateLimiterReactive
public class RedissonRateLimiterReactive extends Object implements RRateLimiterReactive
Constructor | Description |
---|---|
RedissonRateLimiterReactive(CommandReactiveExecutor connectionManager,
String name) |
Modifier and Type | Method | Description |
---|---|---|
org.reactivestreams.Publisher<Void> |
acquire() |
Acquires a permit from this RateLimiter, blocking until one is available.
|
org.reactivestreams.Publisher<Void> |
acquire(long permits) |
Acquires a specified
permits from this RateLimiter,
blocking until one is available. |
org.reactivestreams.Publisher<Void> |
copy(String host,
int port,
int database,
long timeout) |
Copy object from source Redis instance to destination Redis instance
|
org.reactivestreams.Publisher<Boolean> |
delete() |
Delete object in mode
|
org.reactivestreams.Publisher<byte[]> |
dump() |
Returns dump of object
|
protected io.netty.buffer.ByteBuf |
encode(Object value) |
|
protected void |
encode(Collection<Object> params,
Collection<?> values) |
|
protected io.netty.buffer.ByteBuf |
encodeMapKey(Object value) |
|
protected io.netty.buffer.ByteBuf |
encodeMapValue(Object value) |
|
Codec |
getCodec() |
|
String |
getName() |
|
org.reactivestreams.Publisher<Boolean> |
isExists() |
Check object existence
|
org.reactivestreams.Publisher<Void> |
migrate(String host,
int port,
int database,
long timeout) |
Transfer a object from a source Redis instance to a destination Redis instance
in mode
|
org.reactivestreams.Publisher<Boolean> |
move(int database) |
Move object to another database in mode
|
protected <V> reactor.rx.Stream<V> |
newSucceeded(V result) |
|
<R> org.reactivestreams.Publisher<R> |
reactive(reactor.fn.Supplier<RFuture<R>> supplier) |
|
org.reactivestreams.Publisher<Void> |
rename(String newName) |
Rename current object key to
newName
in mode |
org.reactivestreams.Publisher<Boolean> |
renamenx(String newName) |
Rename current object key to
newName
in mode only if new key is not exists |
org.reactivestreams.Publisher<Void> |
restore(byte[] state) |
Restores object using its state returned by
RObjectReactive.dump() method. |
org.reactivestreams.Publisher<Void> |
restore(byte[] state,
long timeToLive,
TimeUnit timeUnit) |
Restores object using its state returned by
RObjectReactive.dump() method and set time to live for it. |
org.reactivestreams.Publisher<Void> |
restoreAndReplace(byte[] state) |
Restores and replaces object if it already exists.
|
org.reactivestreams.Publisher<Void> |
restoreAndReplace(byte[] state,
long timeToLive,
TimeUnit timeUnit) |
Restores and replaces object if it already exists and set time to live for it.
|
org.reactivestreams.Publisher<Boolean> |
touch() |
Update the last access time of an object.
|
org.reactivestreams.Publisher<Boolean> |
tryAcquire() |
Acquires a permit only if one is available at the
time of invocation.
|
org.reactivestreams.Publisher<Boolean> |
tryAcquire(long permits) |
Acquires the given number of
permits only if all are available at the
time of invocation. |
org.reactivestreams.Publisher<Boolean> |
tryAcquire(long permits,
long timeout,
TimeUnit unit) |
Acquires the given number of
permits only if all are available
within the given waiting time. |
org.reactivestreams.Publisher<Boolean> |
tryAcquire(long timeout,
TimeUnit unit) |
Acquires a permit from this RateLimiter, if one becomes available
within the given waiting time.
|
org.reactivestreams.Publisher<Boolean> |
trySetRate(RateType mode,
long rate,
long rateInterval,
RateIntervalUnit rateIntervalUnit) |
Initializes RateLimiter's state and stores config to Redis server.
|
org.reactivestreams.Publisher<Boolean> |
unlink() |
Delete the objects.
|
public RedissonRateLimiterReactive(CommandReactiveExecutor connectionManager, String name)
public org.reactivestreams.Publisher<Boolean> trySetRate(RateType mode, long rate, long rateInterval, RateIntervalUnit rateIntervalUnit)
RRateLimiterReactive
trySetRate
in interface RRateLimiterReactive
mode
- - rate moderate
- - raterateInterval
- - rate time intervalrateIntervalUnit
- - rate time interval unitpublic org.reactivestreams.Publisher<Boolean> tryAcquire()
RRateLimiterReactive
Acquires a permit, if one is available and returns immediately,
with the value true
,
reducing the number of available permits by one.
If no permit is available then this method will return
immediately with the value false
.
tryAcquire
in interface RRateLimiterReactive
true
if a permit was acquired and false
otherwisepublic org.reactivestreams.Publisher<Boolean> tryAcquire(long permits)
RRateLimiterReactive
permits
only if all are available at the
time of invocation.
Acquires a permits, if all are available and returns immediately,
with the value true
,
reducing the number of available permits by given number of permits.
If no permits are available then this method will return
immediately with the value false
.
tryAcquire
in interface RRateLimiterReactive
permits
- the number of permits to acquiretrue
if a permit was acquired and false
otherwisepublic org.reactivestreams.Publisher<Void> acquire()
RRateLimiterReactive
Acquires a permit, if one is available and returns immediately, reducing the number of available permits by one.
acquire
in interface RRateLimiterReactive
public org.reactivestreams.Publisher<Void> acquire(long permits)
RRateLimiterReactive
permits
from this RateLimiter,
blocking until one is available.
Acquires the given number of permits, if they are available and returns immediately, reducing the number of available permits by the given amount.
acquire
in interface RRateLimiterReactive
public org.reactivestreams.Publisher<Boolean> tryAcquire(long timeout, TimeUnit unit)
RRateLimiterReactive
Acquires a permit, if one is available and returns immediately,
with the value true
,
reducing the number of available permits by one.
If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies dormant until specified waiting time elapses.
If a permit is acquired then the value true
is returned.
If the specified waiting time elapses then the value false
is returned. If the time is less than or equal to zero, the method
will not wait at all.
tryAcquire
in interface RRateLimiterReactive
timeout
- the maximum time to wait for a permitunit
- the time unit of the timeout
argumenttrue
if a permit was acquired and false
if the waiting time elapsed before a permit was acquiredpublic org.reactivestreams.Publisher<Boolean> tryAcquire(long permits, long timeout, TimeUnit unit)
RRateLimiterReactive
permits
only if all are available
within the given waiting time.
Acquires the given number of permits, if all are available and returns immediately,
with the value true
, reducing the number of available permits by one.
If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies dormant until the specified waiting time elapses.
If a permits is acquired then the value true
is returned.
If the specified waiting time elapses then the value false
is returned. If the time is less than or equal to zero, the method
will not wait at all.
tryAcquire
in interface RRateLimiterReactive
permits
- amounttimeout
- the maximum time to wait for a permitunit
- the time unit of the timeout
argumenttrue
if a permit was acquired and false
if the waiting time elapsed before a permit was acquiredpublic <R> org.reactivestreams.Publisher<R> reactive(reactor.fn.Supplier<RFuture<R>> supplier)
protected <V> reactor.rx.Stream<V> newSucceeded(V result)
public String getName()
getName
in interface RObjectReactive
public Codec getCodec()
getCodec
in interface RObjectReactive
protected void encode(Collection<Object> params, Collection<?> values)
protected io.netty.buffer.ByteBuf encode(Object value)
protected io.netty.buffer.ByteBuf encodeMapKey(Object value)
protected io.netty.buffer.ByteBuf encodeMapValue(Object value)
public org.reactivestreams.Publisher<Void> restore(byte[] state)
RObjectReactive
RObjectReactive.dump()
method.restore
in interface RObjectReactive
state
- - state of objectpublic org.reactivestreams.Publisher<Void> restore(byte[] state, long timeToLive, TimeUnit timeUnit)
RObjectReactive
RObjectReactive.dump()
method and set time to live for it.restore
in interface RObjectReactive
state
- - state of objecttimeToLive
- - time to live of the objecttimeUnit
- - time unitpublic org.reactivestreams.Publisher<Void> restoreAndReplace(byte[] state)
RObjectReactive
restoreAndReplace
in interface RObjectReactive
state
- - state of the objectpublic org.reactivestreams.Publisher<Void> restoreAndReplace(byte[] state, long timeToLive, TimeUnit timeUnit)
RObjectReactive
restoreAndReplace
in interface RObjectReactive
state
- - state of the objecttimeToLive
- - time to live of the objecttimeUnit
- - time unitpublic org.reactivestreams.Publisher<byte[]> dump()
RObjectReactive
dump
in interface RObjectReactive
public org.reactivestreams.Publisher<Boolean> touch()
RObjectReactive
touch
in interface RObjectReactive
true
if object was touched else false
public org.reactivestreams.Publisher<Boolean> unlink()
RObjectReactive
Requires Redis 4.0+
unlink
in interface RObjectReactive
true
if it was exist and deleted else false
public org.reactivestreams.Publisher<Void> copy(String host, int port, int database, long timeout)
RObjectReactive
copy
in interface RObjectReactive
host
- - destination hostport
- - destination portdatabase
- - destination databasetimeout
- - maximum idle time in any moment of the communication with the destination instance in millisecondspublic org.reactivestreams.Publisher<Void> rename(String newName)
RObjectReactive
newName
in moderename
in interface RObjectReactive
newName
- - new name of objectpublic org.reactivestreams.Publisher<Void> migrate(String host, int port, int database, long timeout)
RObjectReactive
migrate
in interface RObjectReactive
host
- - destination hostport
- - destination portdatabase
- - destination databasetimeout
- - maximum idle time in any moment of the communication with the destination instance in millisecondspublic org.reactivestreams.Publisher<Boolean> move(int database)
RObjectReactive
move
in interface RObjectReactive
database
- - number of Redis databasetrue
if key was moved false
if notpublic org.reactivestreams.Publisher<Boolean> renamenx(String newName)
RObjectReactive
newName
in mode only if new key is not existsrenamenx
in interface RObjectReactive
newName
- - new name of objecttrue
if object has been renamed successfully and false
otherwisepublic org.reactivestreams.Publisher<Boolean> delete()
RObjectReactive
delete
in interface RObjectReactive
true
if object was deleted false
if notpublic org.reactivestreams.Publisher<Boolean> isExists()
RObjectReactive
isExists
in interface RObjectReactive
true
if object exists and false
otherwiseCopyright © 2014–2018 The Redisson Project. All rights reserved.