XF 2.1 Cache a query or page?

Robert9

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:

Code:
// 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?
 
Seems we dont save result of queries with simpleCache?

 

I have read this, but i still dont know what is cached now with 2.1 or what i could cache.

Are pages cached now for all guests? Which pages? And how long? And what is the trigger to renew the cache for what?
 
Back
Top Bottom