The best way to cache Presenter->link()?
Notice: This thread is very old.
- David Šolc
- Member | 5
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.
http://postimg.org/image/90n3qd39f
10.4+8.9+5.7+4.9+4.7 = 34.6% of time is taking link() method
Here is a result without links.
http://postimg.org/…e/cybdudfnf/
So, I was wondering, what is the best way to cache links?
Thank you for any hints.
- David Grudl
- Nette Core | 8229
{var $magic = 9999}
{capture $link}{link Product:detail $magic}{/capture}
{foreach $products as $product}
<a href="{$link|replace:$magic:$product->id}">...</a>
{/foreach}