XF 2.1 Cache a query or page?


Well-known member
Two days a day i get some new threads in a special forum.
These threads are fetched and shown on an own page.

The query is something like:

// some wheres

            $threadFinder->where('post_date', '>=', \XF::$time - ($dateLimitDays * 86400));

// fetch data
        $threadFinder->limitByPage($page, $perPage, $perPage * 2);

        /** @var \XF\Entity\Thread $thread */
        foreach ($threads = $threadFinder->fetch() AS $threadId => $thread)
// do something witht the threads

// throw in Params
        $viewParams = [
            'threads' => $threads,
            'total' => $total,
            'perPage' => $perPage,
            'page' => $page,
            'style' => $style,

// send to template
        return $this->view('Robert9\Anzeigen:Anzeigen:Index', 'r9_anzeigen_view', $viewParams);

It would be enough to do this query one time in an hour. What should i cache now and how?
The result of the query, the page itself?

Where can i find an example, please?


Well-known member
Seems we dont save result of queries with simpleCache?