|
Spring Data Key-Value | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Number org.springframework.data.keyvalue.redis.support.atomic.RedisAtomicInteger
public class RedisAtomicInteger
Atomic integer backed by Redis. Uses Redis atomic increment/decrement and watch/multi/exec operations for CAS operations.
AtomicInteger
,
Serialized FormConstructor Summary | |
---|---|
RedisAtomicInteger(String redisCounter,
RedisConnectionFactory factory)
Constructs a new RedisAtomicInteger instance. |
|
RedisAtomicInteger(String redisCounter,
RedisConnectionFactory factory,
int initialValue)
Constructs a new RedisAtomicInteger instance. |
|
RedisAtomicInteger(String redisCounter,
RedisOperations<String,Integer> operations)
Constructs a new RedisAtomicInteger instance. |
|
RedisAtomicInteger(String redisCounter,
RedisOperations<String,Integer> operations,
int initialValue)
Constructs a new RedisAtomicInteger instance with the given initial value. |
Method Summary | |
---|---|
int |
addAndGet(int delta)
Atomically add the given value to current value. |
boolean |
compareAndSet(int expect,
int update)
Atomically set the value to the given updated value if the current value == the expected value. |
int |
decrementAndGet()
Atomically decrement by one the current value. |
double |
doubleValue()
|
float |
floatValue()
|
int |
get()
Get the current value. |
int |
getAndAdd(int delta)
Atomically add the given value to current value. |
int |
getAndDecrement()
Atomically decrement by one the current value. |
int |
getAndIncrement()
Atomically increment by one the current value. |
int |
getAndSet(int newValue)
Set to the give value and return the old value. |
String |
getKey()
Returns the key associated with this entity. |
int |
incrementAndGet()
Atomically increment by one the current value. |
int |
intValue()
|
long |
longValue()
|
void |
set(int newValue)
Set 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 RedisAtomicInteger(String redisCounter, RedisConnectionFactory factory)
RedisAtomicInteger
instance.
redisCounter
- redis counterfactory
- connection factorypublic RedisAtomicInteger(String redisCounter, RedisConnectionFactory factory, int initialValue)
RedisAtomicInteger
instance.
redisCounter
- factory
- initialValue
- public RedisAtomicInteger(String redisCounter, RedisOperations<String,Integer> operations)
RedisAtomicInteger
instance. Uses as initial value
the data from the backing store (sets the counter to 0 if no value is found).
Use RedisAtomicInteger(String, RedisOperations, int)
to set the counter to a certain value
as an alternative constructor or set(int)
.
redisCounter
- operations
- public RedisAtomicInteger(String redisCounter, RedisOperations<String,Integer> operations, int initialValue)
RedisAtomicInteger
instance with the given initial value.
redisCounter
- operations
- initialValue
- Method Detail |
---|
public String getKey()
KeyBound
getKey
in interface KeyBound<String>
public int get()
public void set(int newValue)
newValue
- the new valuepublic int getAndSet(int newValue)
newValue
- the new value
public boolean compareAndSet(int expect, int update)
expect
- the expected valueupdate
- the new value
public int getAndIncrement()
public int getAndDecrement()
public int getAndAdd(int delta)
delta
- the value to add
public int incrementAndGet()
public int decrementAndGet()
public int addAndGet(int delta)
delta
- the value to add
public String toString()
toString
in class Object
public int intValue()
intValue
in class Number
public long longValue()
longValue
in class Number
public float floatValue()
floatValue
in class Number
public double doubleValue()
doubleValue
in class Number
|
Spring Data Key-Value | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |