protected function paginateList($target, $pageNumber, $maxResults, $list = null, $useCache = true)
{
if (!$list) {
$list = new ListResult();
}
if (!$pageNumber) {
$pageNumber = $this->pageNumber;
}
$cacheId = $this->cacheService->getCacheKey(array($this->getCacheKey(), $this->getPageNumber()), $this->getName());
if ($this->cacheService->contains($cacheId) && $useCache) {
$this->pagination = $this->cacheService->fetch($cacheId);
} else {
$this->pagination = $this->paginatorService->paginate($target, $pageNumber, $maxResults);
$this->cacheService->save($cacheId, $this->pagination);
}
$list->count = count($this->pagination->getItems());
$list->items = $this->pagination->getItems();
return $list;
}