@Qualifier(value="aggregate") public class RedisAggregateCounterRepository extends RedisCounterRepository implements AggregateCounterRepository
AggregateCounterRepository
. Subclasses and intercepts calls to
RedisCounterRepository
to also track counts in various redis hashes.Modifier and Type | Field and Description |
---|---|
protected org.springframework.data.redis.core.HashOperations<java.lang.String,java.lang.String,java.lang.Long> |
hashOperations |
protected org.springframework.data.redis.core.SetOperations<java.lang.String,java.lang.String> |
setOperations |
longOperations
redisOperations, repoPrefix, zSetOperations
Constructor and Description |
---|
RedisAggregateCounterRepository(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory) |
Modifier and Type | Method and Description |
---|---|
void |
delete(java.lang.String id) |
AggregateCount |
getCounts(java.lang.String name,
int nCounts,
AggregateCountResolution resolution)
Query function which returns the last 'n' points for a particular resolution.
|
AggregateCount |
getCounts(java.lang.String name,
int nCounts,
org.joda.time.DateTime endDate,
AggregateCountResolution resolution)
Queries by requesting a number of points, ending on the given date (inclusive).
|
AggregateCount |
getCounts(java.lang.String name,
org.joda.time.Interval interval,
AggregateCountResolution resolution)
For each query, we need to convert the interval into two variations.
|
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,
org.joda.time.DateTime dateTime)
Increments the named counter by a specific amount for the given instant.
|
decrement, deserialize, deserializeId, increment, keyFor, reset, serialize, serializeId
count, 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
decrement, increment, reset
findAll, findAll
count, delete, delete, deleteAll, exists, findAll, findAll, findOne, save, save
findAllInRange
protected org.springframework.data.redis.core.HashOperations<java.lang.String,java.lang.String,java.lang.Long> hashOperations
protected org.springframework.data.redis.core.SetOperations<java.lang.String,java.lang.String> setOperations
public RedisAggregateCounterRepository(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory)
redisConnectionFactory
- public long increment(java.lang.String name)
CounterRepository
increment
in interface CounterRepository
increment
in class RedisCounterRepository
public long increment(java.lang.String name, long amount, org.joda.time.DateTime dateTime)
AggregateCounterRepository
increment
in interface AggregateCounterRepository
public AggregateCount getCounts(java.lang.String name, int nCounts, AggregateCountResolution resolution)
AggregateCounterRepository
getCounts
in interface AggregateCounterRepository
name
- the counter to querynCounts
- the number of data points to returnresolution
- the resolution at which the data should be returned (minute, hour, day, month)public AggregateCount getCounts(java.lang.String name, int nCounts, org.joda.time.DateTime endDate, AggregateCountResolution resolution)
AggregateCounterRepository
getCounts
in interface AggregateCounterRepository
name
- the counter to querynCounts
- the number of data points to returnendDate
- the end of the query interval (inclusive). Cannot be null.resolution
- the resolution at which the data should be returned (minute, hour, day, month)public AggregateCount getCounts(java.lang.String name, org.joda.time.Interval interval, AggregateCountResolution resolution)
getCounts
in interface AggregateCounterRepository
name
- the counter to queryinterval
- the time interval to return data for. Includes start and end.resolution
- the resolution at which the data should be returned (minute, hour, day, month)public void delete(java.lang.String id)
delete
in interface org.springframework.data.repository.CrudRepository<Counter,java.lang.String>
delete
in class AbstractRedisRepository<Counter,java.lang.String>