public class RedisCounterService extends java.lang.Object implements CounterService
| Constructor and Description |
|---|
RedisCounterService(RedisCounterRepository counterRepository) |
| Modifier and Type | Method and Description |
|---|---|
void |
decrement(java.lang.String name)
Decrement the counter by one
|
Counter |
getOrCreate(java.lang.String name)
Returns an existing counter for the given name or creates a new counter set to zero
|
void |
increment(java.lang.String name)
Increment the counter by one
|
void |
reset(java.lang.String name)
Reset the counter to zero
|
public RedisCounterService(RedisCounterRepository counterRepository)
public Counter getOrCreate(java.lang.String name)
CounterServicegetOrCreate in interface CounterServicename - name of the counterpublic void increment(java.lang.String name)
CounterServiceincrement in interface CounterServicename - the counter namepublic void decrement(java.lang.String name)
CounterServicedecrement in interface CounterServicename - the counter namepublic void reset(java.lang.String name)
CounterServicereset in interface CounterServicename - the counter name