public class CacheV2RequestHandler extends BaseDataRequestHandler
It also wraps the response processor so that valid, non-partial JSON responses are cached
Modifier and Type | Field and Description |
---|---|
static com.codahale.metrics.Meter |
CACHE_HITS |
static com.codahale.metrics.Meter |
CACHE_MISSES |
static com.codahale.metrics.Meter |
CACHE_POTENTIAL_HITS |
static com.codahale.metrics.Meter |
CACHE_REQUESTS |
protected TupleDataCache<String,Long,String> |
dataCache |
protected DataRequestHandler |
next |
protected QuerySigningService<Long> |
querySigningService |
mapper, writer
Constructor and Description |
---|
CacheV2RequestHandler(DataRequestHandler next,
DataCache<?> dataCache,
QuerySigningService<?> querySigningService,
com.fasterxml.jackson.databind.ObjectMapper mapper)
Build a Cache request handler.
|
Modifier and Type | Method and Description |
---|---|
protected String |
getKey(DruidAggregationQuery<?> druidQuery)
Construct the cache key.
|
boolean |
handleRequest(RequestContext context,
DataApiRequest request,
DruidAggregationQuery<?> druidQuery,
ResponseProcessor response)
Handle the response, passing the request down the chain as necessary.
|
public static final com.codahale.metrics.Meter CACHE_HITS
public static final com.codahale.metrics.Meter CACHE_POTENTIAL_HITS
public static final com.codahale.metrics.Meter CACHE_MISSES
public static final com.codahale.metrics.Meter CACHE_REQUESTS
@NotNull protected final DataRequestHandler next
@NotNull protected final TupleDataCache<String,Long,String> dataCache
@NotNull protected final QuerySigningService<Long> querySigningService
public CacheV2RequestHandler(DataRequestHandler next, @NotNull DataCache<?> dataCache, QuerySigningService<?> querySigningService, com.fasterxml.jackson.databind.ObjectMapper mapper)
next
- The next handler in the chaindataCache
- The cache instancequerySigningService
- The service to generate query signaturesmapper
- The mapper for all JSON processingpublic boolean handleRequest(RequestContext context, DataApiRequest request, DruidAggregationQuery<?> druidQuery, ResponseProcessor response)
DataRequestHandler
context
- The context for the Requestrequest
- The Api Request ObjectdruidQuery
- The druid queryresponse
- The Async responseprotected String getKey(DruidAggregationQuery<?> druidQuery) throws com.fasterxml.jackson.core.JsonProcessingException
druidQuery
- The druid query.com.fasterxml.jackson.core.JsonProcessingException
- if the druid query cannot be serialized to JSONCopyright © 2016–2018 Yahoo! Inc.. All rights reserved.