Knowledge Base / The Appnel Group 

Last Modified
30 January 2008 @ 11am

Cache Output for Movable Type Manual

NAME

Cache Output for MT - speeds the publishing of pages by caching repetitive blocks of output (content) in memory.

SYNOPSIS

  # page one
  <mt:cacheoutput name="example">
     <!-- The output from this markup will be stored in
     memory once generated. -->
  </mt:cacheoutput>
  
  # later in the rebuild process... page two.
  <mt:cacheoutput name="example">
     <!-- These tags are NOT processed, but replaced with
     the output of the first "example" block regardless
     of this tag's contents. -->
  </mt:cacheoutput>
    

DESCRIPTION

This plugin provides a simple block tag that will store the output of its contents in the request or context object. Subsequent appearances of the mt:cacheoutput tagset with the same name will simply replace its contents with the output stored in memory. Depending on the contents of the tagset, this can significantly improve the speed of MT page rebuilds by eliminating costly and redundant processing to produce the same output.

For example, infrequently updated footer or sidebar items are excellent candidates in which this plugin can be applied.

TAGS

mt:cacheoutput name="" [scope="request|context"]

A container tag that will process the contained markup and cache it within the defined scope. Later occurances of the tag with the same name and scope will insert the cached output rather then process the contained markup.

The tag takes 2 arguments:

  • name

    REQUIRED. The value of this argument is a string that will unique identify this block of output throughout its scope.

  • scope

    OPTIONAL. A value of either "request" or "context" can be passed in to define the scope that the output should be kept. The default is "context" -- the output will only be cache for the current page.

On Scope

Note that the two cache output blocks with the same name, but different scopes are treated as if they where named something entirely different with the same scope.

The following would cache/output two different blocks of output:

  <mt:cacheoutput name="example" scope="request">
    This output will be cached for the life of the request.
  </mt:cacheoutput>

  <mt:cacheoutput name="example" scope="request">
    This output will be cached for the life of the page
    context.
  </mt:cacheoutput>

TO DO

  • Simple longer term options such as file based-caching.
  • Implement expiry option.

SUPPORT

Support issues should be directed to the Movable Type Community Forums at http://community.movabletype.org/.

AUTHOR

Timothy Appnel

COPYRIGHT AND LICENSE

The software is released under the Artistic License. The terms of the Artistic License are described at http://www.perl.com/language/misc/Artistic.html. Except where otherwise noted, Cache Output for MT is Copyright 2008, Timothy Appnel, http://appnel.com/. All rights reserved.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

  • Around line 63:

    You forgot a '=back' before '=head3'


 

Submit Feedback on This Article

Your comments on how we can improve this article are appreciated. Please do not use the feedback form to submit support requests or question. We will not respond to or publish such queries submitted through this form.

Back to Home