use of org.apache.gora.jcache.query.JCacheResult in project gora by apache.
the class JCacheStore method execute.
@Override
public Result<K, T> execute(Query<K, T> query) throws GoraException {
K startKey = query.getStartKey();
K endKey = query.getEndKey();
if (startKey == null) {
if (!cacheEntryList.isEmpty()) {
startKey = (K) cacheEntryList.first();
}
}
if (endKey == null) {
if (!cacheEntryList.isEmpty()) {
endKey = (K) cacheEntryList.last();
}
}
query.setFields(getFieldsToQuery(query.getFields()));
NavigableSet<K> cacheEntrySubList = null;
if (startKey != null && endKey != null) {
try {
cacheEntrySubList = cacheEntryList.subSet(startKey, true, endKey, true);
} catch (Exception e) {
throw new GoraException(e);
}
} else {
// Empty
cacheEntrySubList = Collections.emptyNavigableSet();
}
return new JCacheResult<>(this, query, cacheEntrySubList);
}
Aggregations