Jump to:

1368 Posts in 487 Topics by 521 members

Themes

SilverStripe Forums » Themes » Partial caching to reduce SQL queries?

Discuss SilverStripe Themes.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 651 Views
  • rob.s
    Avatar
    Community Member
    78 Posts

    Partial caching to reduce SQL queries? Link to this post

    Hi ladies,

    as mentioned in the docs (http://doc.silverstripe.org/framework/en/3.1/reference/partial-caching) i thought, that using partial caching could also reduce the number of sql queries.

    When using

    <% cached 'MenuLeft', List(SiteTree).max(LastEdited) %>
    <ul>
          <% loop $Menu(1) %>
             <li class="$LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle.XML</a></li>
          <% end_loop %>
       </ul>
    <% end_cached %>

    When i check by using ?showqueries=1 the sql-queries stack is exactly the same?

    Confusing (to me) ....

  • martimiz
    Avatar
    Forum Moderator
    1067 Posts

    Re: Partial caching to reduce SQL queries? Link to this post

    Sir,

    I'm not sure that this is the case here, because I've seen a some discussions of partial caching not always actually caching... But just a hunch: SilverStripe tries to cache many of its queries and objects along the way, so could it be that menu(1) already uses cached queries in the first place?

    I often test these kind of things by placing some echo "*****" in the function involved, say at the start and the end of the function. Kinda simplistic and dirty, I know, (hiding my face) but quick to spot any sql queries executed by that specific function

    651 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.