About Sitellite       Screenshots       Downloads       Forge      Documentation       Community       Support

You are here: Home / Documentation / Caching for Better Performance

Caching for Better Performance

Partial-page caching

Sitellite features partial-page caching with the <xt:cache> commands in your XT templates, or by accessing the global $cache object directly.  The <xt:cache> tags offer unfortunately little performance improvement in most cases however, since XT still has to parse and loop through the tags between the <xt:cache and </xt:cache> either way.  Essentially, this will only see performance improvements when you wrap these tags around content that requires that boost in performance.  XT itself is efficient enough that simply caching parts of the template that don't call external applications won't yield much benefit.  For example:
<xt:cache>
  <table>
    <tr xt:loop="i php: range (1, 10)">
      <td xt:content="loop/i/_key">0</td>
      <td xt:content="loop/i/_odd">1</td>
      <td xt:content="loop/i/_value">1</td>
    </tr>
  </table>
</xt:cache>
In this case, the extra <xt:cache> tags might add more overhead than they're worth, since they add an extra conditional evaluation to the template, and potentially reading and writing to the cache store, which could take more time than a simple loop from 1 to 10.

However, in the case of calling an external box, <xt:cache> could yield a noticeable improvement.  For example:
<xt:cache>
  <xt:box name="sitellite/sidebar" position="left" />
</xt:cache>
Another feature of <xt:cache> is the ability to cache a separate copy for each specific visitor, so that performance is boosted on subsequent page requests from the same visitor.  This has the advantage of allowing content to be cacheable that still contains personalized data.  For example:
<xt cache scope="session">
  <h2>Your profile, <xt:var name="session/firstname" />:</h2>
  <xt:box name="myapp/user/profile" />
</xt:cache>
In this case, if we didn't include the scope="session", the next visitor to that screen would see the previous visitor's name and profile information -- a big privacy faux pas!

Next: Query-level caching

Page 1: Caching in General
Page 2: Caching in Sitellite
Page 3: Partial-page caching
Page 4: Query-level caching

All Tutorials

Members

Note: You can use your SitelliteForge.com account here and vice versa.

Username

Password

Forgot your password?

Not a member? Click here to register

Sitellite 5 Beta


Copyright © 2008, SIMIAN systems Inc.
All rights reserved. Privacy policy
Some of the icons on this site were created by the Gnome Project.