I'm building a search functionality that returns large collections which are paginated using a LengthAwarePaginator. I'm trying to cache results using a key called $searchFilter\_$query\_$offsetPages for a single page of returned results (10 items). It goes into the cache just fine. However, it times out when I try to check using Cache::has($key) or fetch using Cache::get($key).

The same problem occurs in the browser as well as in artisan Tinker. Strangely, when I put a random set of 10 items into the cache in Tinker and fetch them back, everything works fine. I'm using Redis as the cache driver.

Here is my controller method:

```
public function search($filter, $query, $layout, Request $request) {
  if($layout == "list-map") {
    return view("list-map")->with(['filter' => $filter, 'query' => $query, 'layout' => 'list-map']);      
  } else {
    $offsetPages = $request->input('page', 1) - 1;
    $cacheKey = $filter . "_" . $query . "_" . $offsetPages;

    if(Cache::has($cacheKey)) {
      \Log::info("fetching results from cache");
      $data = Cache::get($cacheKey);

      $totalCt = $data[0];
      $results = $data[1];
    } else {
      $results = $this->getResults($filter, $query);
      $totalCt = $results->count();
      $results = $results->slice($offsetPages, $this->resultsPerPage);

      \Log::info("caching results");
      Cache::put($cacheKey, [$totalCt, $results], 5);
    }

  $results = new LengthAwarePaginator($results,
    $totalCt,
    $this->resultsPerPage,
    $request->input('page', 1),
    ['path' => LengthAwarePaginator::resolveCurrentPath()]
  );

    return view($layout)->with(['filter' => $filter, 'query' => $query, 'layout' => $layout, 'results' => $results]);
  }

}

```