public class RedisAtomicDouble extends Number implements Serializable, BoundKeyOperations<String>
| Constructor and Description |
|---|
RedisAtomicDouble(String redisCounter,
RedisConnectionFactory factory)
Constructs a new
RedisAtomicDouble instance. |
RedisAtomicDouble(String redisCounter,
RedisConnectionFactory factory,
double initialValue)
Constructs a new
RedisAtomicDouble instance. |
RedisAtomicDouble(String redisCounter,
RedisOperations<String,Double> template)
Constructs a new
RedisAtomicDouble instance. |
RedisAtomicDouble(String redisCounter,
RedisOperations<String,Double> template,
double initialValue)
Constructs a new
RedisAtomicDouble instance. |
| Modifier and Type | Method and Description |
|---|---|
double |
addAndGet(double delta)
Atomically add the given value to current value.
|
boolean |
compareAndSet(double expect,
double update)
Atomically set the value to the given updated value if the current value
== the expected value. |
double |
decrementAndGet()
Atomically decrement by one the current value.
|
double |
doubleValue() |
Boolean |
expire(long timeout,
TimeUnit unit)
Sets the key time-to-live/expiration.
|
Boolean |
expireAt(Date date)
Sets the key time-to-live/expiration.
|
float |
floatValue() |
double |
get()
Get the current value.
|
double |
getAndAdd(double delta)
Atomically add the given value to current value.
|
double |
getAndDecrement()
Atomically decrement by one the current value.
|
double |
getAndIncrement()
Atomically increment by one the current value.
|
double |
getAndSet(double newValue)
Set to the given value and return the old value.
|
Long |
getExpire()
Returns the expiration of this key.
|
String |
getKey()
Returns the key associated with this entity.
|
DataType |
getType()
Returns the associated Redis type.
|
double |
incrementAndGet()
Atomically increment by one the current value.
|
int |
intValue() |
long |
longValue() |
Boolean |
persist()
Removes the expiration (if any) of the key.
|
void |
rename(String newKey)
Renames the key.
|
void |
set(double newValue)
Set to the given value.
|
String |
toString() |
byteValue, shortValuepublic RedisAtomicDouble(String redisCounter, RedisConnectionFactory factory)
RedisAtomicDouble instance. Uses the value existing in Redis or 0 if none is found.redisCounter - Redis key of this counter.factory - connection factory.public RedisAtomicDouble(String redisCounter, RedisConnectionFactory factory, double initialValue)
RedisAtomicDouble instance.redisCounter - Redis key of this counter.factory - connection factory.initialValue - initial value to set if the Redis key is absent.public RedisAtomicDouble(String redisCounter, RedisOperations<String,Double> template)
RedisAtomicDouble instance. Uses the value existing in Redis or 0 if none is found.redisCounter - Redis key of this counter.template - the template.RedisAtomicDouble(String, RedisConnectionFactory, double)public RedisAtomicDouble(String redisCounter, RedisOperations<String,Double> template, double initialValue)
RedisAtomicDouble instance. Note: You need to configure the given template with
appropriate RedisSerializer for the key and value. As an alternative one could use the
RedisAtomicDouble(String, RedisConnectionFactory, Double) constructor which uses appropriate default
serializers.redisCounter - Redis key of this counter.template - the templateinitialValue - initial value to set if the Redis key is absent.public double get()
public void set(double newValue)
newValue - the new value.public double getAndSet(double newValue)
newValue - the new value.public boolean compareAndSet(double expect,
double update)
== the expected value.expect - the expected value.update - the new value.public double getAndIncrement()
public double getAndDecrement()
public double getAndAdd(double delta)
delta - the value to add.public double incrementAndGet()
public double decrementAndGet()
public double addAndGet(double delta)
delta - the value to add.public String toString()
public String getKey()
BoundKeyOperationsgetKey in interface BoundKeyOperations<String>public DataType getType()
BoundKeyOperationsgetType in interface BoundKeyOperations<String>public Long getExpire()
BoundKeyOperationsgetExpire in interface BoundKeyOperations<String>public Boolean expire(long timeout, TimeUnit unit)
BoundKeyOperationsexpire in interface BoundKeyOperations<String>timeout - expiration valueunit - expiration unitpublic Boolean expireAt(Date date)
BoundKeyOperationsexpireAt in interface BoundKeyOperations<String>date - expiration datepublic Boolean persist()
BoundKeyOperationspersist in interface BoundKeyOperations<String>public void rename(String newKey)
BoundKeyOperationsrename in interface BoundKeyOperations<String>newKey - new key. Must not be null.public float floatValue()
floatValue in class Numberpublic double doubleValue()
doubleValue in class NumberCopyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.