@Qualifier(value="simple") public class RedisCounterRepository extends AbstractRedisRepository<Counter,java.lang.String> implements CounterRepository
Modifier and Type | Field and Description |
---|---|
protected org.springframework.data.redis.core.ValueOperations<java.lang.String,java.lang.Long> |
longOperations |
redisOperations, repoPrefix, zSetOperations
Constructor and Description |
---|
RedisCounterRepository(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory) |
RedisCounterRepository(java.lang.String repoPrefix,
org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory) |
Modifier and Type | Method and Description |
---|---|
long |
decrement(java.lang.String name)
Decrement the given counter, creating it if it did not exist.
|
protected Counter |
deserialize(java.lang.String redisKey,
java.lang.String v)
Deserialize from the String representation to the domain object.
|
protected java.lang.String |
deserializeId(java.lang.String string)
Deserialize an entity id from its String representation.
|
long |
increment(java.lang.String name)
Increment the given counter by one, creating it if it did not exist.
|
long |
increment(java.lang.String name,
long amount)
Increment the given counter by the specified amount, creating it if it did not exist.
|
protected java.lang.String |
keyFor(Counter entity)
Return the entity id for the given domain object.
|
void |
reset(java.lang.String name)
Reset the given counter to zero.
|
protected java.lang.String |
serialize(Counter entity)
Provide a String representation of the domain entity.
|
protected java.lang.String |
serializeId(java.lang.String id)
Return a String representation of the domain ID.
|
count, delete, delete, delete, deleteAll, exists, findAll, findAll, findAll, findAll, findAllInRange, findOne, getPrefix, idFromRedisKey, redisKeyFromId, save, save, setPrefix, trackMembership
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
findAll, findAll
count, delete, delete, delete, deleteAll, exists, findAll, findAll, findOne, save, save
findAllInRange
protected org.springframework.data.redis.core.ValueOperations<java.lang.String,java.lang.Long> longOperations
public RedisCounterRepository(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory)
public RedisCounterRepository(java.lang.String repoPrefix, org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory)
protected Counter deserialize(java.lang.String redisKey, java.lang.String v)
AbstractRedisRepository
deserialize
in class AbstractRedisRepository<Counter,java.lang.String>
redisKey
- the entity idv
- the serialized representation of the domain objectprotected java.lang.String serialize(Counter entity)
AbstractRedisRepository
serialize
in class AbstractRedisRepository<Counter,java.lang.String>
protected java.lang.String keyFor(Counter entity)
AbstractRedisRepository
keyFor
in class AbstractRedisRepository<Counter,java.lang.String>
protected java.lang.String serializeId(java.lang.String id)
AbstractRedisRepository
serializeId
in class AbstractRedisRepository<Counter,java.lang.String>
protected java.lang.String deserializeId(java.lang.String string)
AbstractRedisRepository
deserializeId
in class AbstractRedisRepository<Counter,java.lang.String>
public long increment(java.lang.String name)
CounterRepository
increment
in interface CounterRepository
public long increment(java.lang.String name, long amount)
CounterRepository
increment
in interface CounterRepository
public long decrement(java.lang.String name)
CounterRepository
decrement
in interface CounterRepository
public void reset(java.lang.String name)
CounterRepository
reset
in interface CounterRepository