|
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.RedisAtomicLong
public class RedisAtomicLong
Atomic long backed by Redis. Uses Redis atomic increment/decrement and watch/multi/exec operations for CAS operations.
AtomicLong
,
Serialized FormConstructor Summary | |
---|---|
RedisAtomicLong(String redisCounter,
RedisConnectionFactory factory)
Constructs a new RedisAtomicLong instance. |
|
RedisAtomicLong(String redisCounter,
RedisConnectionFactory factory,
long initialValue)
Constructs a new RedisAtomicLong instance. |
|
RedisAtomicLong(String redisCounter,
RedisOperations<String,Long> operations)
Constructs a new RedisAtomicLong instance. |
|
RedisAtomicLong(String redisCounter,
RedisOperations<String,Long> operations,
long initialValue)
Constructs a new RedisAtomicLong instance with the given initial value. |
Method Summary | |
---|---|
long |
addAndGet(long delta)
Atomically adds the given value to the current value. |
boolean |
compareAndSet(long expect,
long update)
Atomically sets the value to the given updated value if the current value == the expected value. |
long |
decrementAndGet()
Atomically decrements by one the current value. |
double |
doubleValue()
|
float |
floatValue()
|
long |
get()
Gets the current value. |
long |
getAndAdd(long delta)
Atomically adds the given value to the current value. |
long |
getAndDecrement()
Atomically decrements by one the current value. |
long |
getAndIncrement()
Atomically increments by one the current value. |
long |
getAndSet(long newValue)
Atomically sets to the given value and returns the old value. |
String |
getKey()
Returns the key associated with this entity. |
long |
incrementAndGet()
Atomically increments by one the current value. |
int |
intValue()
|
long |
longValue()
|
void |
set(long 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 RedisAtomicLong(String redisCounter, RedisConnectionFactory factory)
RedisAtomicLong
instance.
redisCounter
- redis counterfactory
- connection factorypublic RedisAtomicLong(String redisCounter, RedisConnectionFactory factory, long initialValue)
RedisAtomicLong
instance.
redisCounter
- factory
- initialValue
- public RedisAtomicLong(String redisCounter, RedisOperations<String,Long> operations)
RedisAtomicLong
instance. Uses as initial value
the data from the backing store (sets the counter to 0 if no value is found).
Use RedisAtomicLong(String, RedisOperations, long)
to set the counter to a certain value
as an alternative constructor or set(long)
.
redisCounter
- operations
- public RedisAtomicLong(String redisCounter, RedisOperations<String,Long> operations, long initialValue)
RedisAtomicLong
instance with the given initial value.
redisCounter
- operations
- initialValue
- Method Detail |
---|
public String getKey()
KeyBound
getKey
in interface KeyBound<String>
public long get()
public void set(long newValue)
newValue
- the new valuepublic long getAndSet(long newValue)
newValue
- the new value
public boolean compareAndSet(long expect, long update)
==
the expected value.
expect
- the expected valueupdate
- the new value
public long getAndIncrement()
public long getAndDecrement()
public long getAndAdd(long delta)
delta
- the value to add
public long incrementAndGet()
public long decrementAndGet()
public long addAndGet(long 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 |