|
|||||||||
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.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. |
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()
|
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()
|
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. |
Long |
getExpire()
Returns the expiration of this key. |
String |
getKey()
Returns the key associated with this entity. |
DataType |
getType()
Returns the associated Redis type. |
long |
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(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
- Method Detail |
---|
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
public String getKey()
BoundKeyOperations
getKey
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 Long getExpire()
BoundKeyOperations
getExpire
in interface BoundKeyOperations<String>
public Boolean persist()
BoundKeyOperations
persist
in interface BoundKeyOperations<String>
public void rename(String newKey)
BoundKeyOperations
rename
in interface BoundKeyOperations<String>
newKey
- new keypublic DataType getType()
BoundKeyOperations
getType
in interface BoundKeyOperations<String>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |