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 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.
|
byteValue, shortValue
public RedisAtomicDouble(String redisCounter, RedisConnectionFactory factory)
RedisAtomicDouble
instance. Uses the value existing in Redis or 0 if none is found.redisCounter
- redis counterfactory
- connection factorypublic 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 templatepublic RedisAtomicDouble(String redisCounter, RedisOperations<String,Double> template, double initialValue)
RedisAtomicDouble
instance.redisCounter
- the redis countertemplate
- the templateinitialValue
- the initial valuepublic double get()
public void set(double newValue)
newValue
- the new valuepublic double getAndSet(double newValue)
newValue
- the new valuepublic boolean compareAndSet(double expect, double update)
==
the expected value.expect
- the expected valueupdate
- the new valuepublic double getAndIncrement()
public double getAndDecrement()
public double getAndAdd(double delta)
delta
- the value to addpublic double incrementAndGet()
public double decrementAndGet()
public double addAndGet(double delta)
delta
- the value to addpublic String toString()
public 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 unitpublic Boolean expireAt(Date date)
BoundKeyOperations
expireAt
in interface BoundKeyOperations<String>
date
- expiration datepublic 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 Number
public float floatValue()
floatValue
in class Number
Copyright © 2015 Pivotal Software, Inc.. All rights reserved.