@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,
org.springframework.retry.RetryOperations retryOperations) |
RedisCounterRepository(java.lang.String repoPrefix,
org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory,
org.springframework.retry.RetryOperations retryOperations) |
| 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, trackMembershipclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindAll, findAllcount, delete, delete, delete, deleteAll, exists, findAll, findAll, findOne, save, savefindAllInRangeprotected org.springframework.data.redis.core.ValueOperations<java.lang.String,java.lang.Long> longOperations
public RedisCounterRepository(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory,
org.springframework.retry.RetryOperations retryOperations)
public RedisCounterRepository(java.lang.String repoPrefix,
org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory,
org.springframework.retry.RetryOperations retryOperations)
protected Counter deserialize(java.lang.String redisKey, java.lang.String v)
AbstractRedisRepositorydeserialize in class AbstractRedisRepository<Counter,java.lang.String>redisKey - the entity idv - the serialized representation of the domain objectprotected java.lang.String serialize(Counter entity)
AbstractRedisRepositoryserialize in class AbstractRedisRepository<Counter,java.lang.String>protected java.lang.String keyFor(Counter entity)
AbstractRedisRepositorykeyFor in class AbstractRedisRepository<Counter,java.lang.String>protected java.lang.String serializeId(java.lang.String id)
AbstractRedisRepositoryserializeId in class AbstractRedisRepository<Counter,java.lang.String>protected java.lang.String deserializeId(java.lang.String string)
AbstractRedisRepositorydeserializeId in class AbstractRedisRepository<Counter,java.lang.String>public long increment(java.lang.String name)
CounterRepositoryincrement in interface CounterRepositorypublic long increment(java.lang.String name,
long amount)
CounterRepositoryincrement in interface CounterRepositorypublic long decrement(java.lang.String name)
CounterRepositorydecrement in interface CounterRepositorypublic void reset(java.lang.String name)
CounterRepositoryreset in interface CounterRepository