The best way to cache Presenter->link() ?

Notice: This thread is very old.
David Šolc
Member | 4

I am rendering a lot of data in overview template. There was no point to paginate the result till now, so I was rendering all of data (±1000 rows) in a table. It was ok until I added some links (4) to each row.

Suddenly response time was much longer, so I profiled the request and here is the result.

10.4+8.9+5.7+4.9+4.7 = 34.6% of time is taking link() method

Here is a result without links.…e/cybdudfnf/

So, I was wondering, what is the best way to cache links?

Thank you for any hints.

Member | 1215

I think problem is in your router. I would say you use database without cache in router, dont you? Use cache for your database query eg. id => slug.

David Grudl
Nette Core | 7340
{var $magic = 9999}
{capture $link}{link Product:detail $magic}{/capture}

{foreach $products as $product}
	<a href="{$link|replace:$magic:$product->id}">...</a>