}
else {
final ListingCache lcache = context.getListingCache();
assert lcache != null : "Null ListingCache";
Integer offset = request.getOffset();
Sorting sorting = request.getSorting();
// get listing state (if cached)
final ListingState state = lcache.getState(sessionId, listingId);
if(state != null) {
log.debug("Found cached state for listing '{}': {}", listingId, state.toString());
if(offset == null) {
offset = state.getOffset();
assert offset != null;
log.debug("Setting offset ({}) from cache for listing: {}", offset, listingId);
}
if(sorting == null) {
sorting = state.getSorting();
assert sorting != null;
log.debug("Setting sorting ({}) from cache for listing: {}", sorting.toString(), listingId);
}
}
handler = lcache.getHandler(sessionId, listingId);
listingStatus = (handler == null ? ListingStatus.NOT_CACHED : ListingStatus.CACHED);