|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Number
org.springframework.data.redis.support.atomic.RedisAtomicDouble
public class RedisAtomicDouble
Atomic double backed by Redis. Uses Redis atomic increment/decrement and watch/multi/exec operations for CAS operations.
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
double |
addAndGet(double delta)
Atomically adds the given value to the current value. |
boolean |
compareAndSet(double expect,
double update)
Atomically sets the value to the given updated value if the current value == the expected value. |
double |
decrementAndGet()
Atomically decrements 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()
Gets the current value. |
double |
getAndAdd(double delta)
Atomically adds the given value to the current value. |
double |
getAndDecrement()
Atomically decrements by one the current value. |
double |
getAndIncrement()
Atomically increments by one the current value. |
double |
getAndSet(double newValue)
Atomically sets to the given value and returns 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 increments 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)
Sets to the given value. |
String |
toString()
Returns the String representation of the current value. |
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public RedisAtomicDouble(String redisCounter,
RedisConnectionFactory factory)
RedisAtomicDouble instance. Uses the value existing in Redis or 0 if none is found.
redisCounter - redis counterfactory - connection factory
public RedisAtomicDouble(String redisCounter,
RedisConnectionFactory factory,
double initialValue)
RedisAtomicDouble instance.
redisCounter - factory - initialValue -
public RedisAtomicDouble(String redisCounter,
RedisOperations<String,Double> template)
RedisAtomicDouble instance. Uses the value existing in Redis or 0 if none is found.
redisCounter - the redis countertemplate - the template
public RedisAtomicDouble(String redisCounter,
RedisOperations<String,Double> template,
double initialValue)
RedisAtomicDouble instance.
redisCounter - the redis countertemplate - the templateinitialValue - the initial value| Method Detail |
|---|
public double get()
public void set(double newValue)
newValue - the new valuepublic double getAndSet(double newValue)
newValue - the new value
public boolean compareAndSet(double expect,
double update)
== the expected value.
expect - the expected valueupdate - 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()
toString in class Objectpublic String getKey()
BoundKeyOperations
getKey in interface BoundKeyOperations<String>public DataType getType()
BoundKeyOperations
getType in interface BoundKeyOperations<String>public Long getExpire()
BoundKeyOperations
getExpire in interface BoundKeyOperations<String>
public Boolean expire(long timeout,
TimeUnit unit)
BoundKeyOperations
expire in interface BoundKeyOperations<String>timeout - expiration valueunit - expiration unit
public Boolean expireAt(Date date)
BoundKeyOperations
expireAt in interface BoundKeyOperations<String>date - expiration date
public Boolean persist()
BoundKeyOperations
persist in interface BoundKeyOperations<String>public void rename(String newKey)
BoundKeyOperations
rename in interface BoundKeyOperations<String>newKey - new keypublic double doubleValue()
doubleValue in class Numberpublic float floatValue()
floatValue in class Numberpublic int intValue()
intValue in class Numberpublic long longValue()
longValue in class Number
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||