[Catalyst] Page fragment caching

Tobias Kremer tobias.kremer at gmail.com
Thu Jan 21 09:08:08 GMT 2010

On Wed, Jan 20, 2010 at 9:02 PM, Tomas Doran <bobtfish at bobtfish.net> wrote:
> As noted by already, serving ESI is a good way to do this. I'd recommend
> Catalyst::View::Component::SubInclude for this.
> It would be perfectly possible (and in fact quite easy) to write a backend
> for that which cached the fragment for you...
> So you can get the best of all worlds - use SubRequest in development, cache
> the fragments now for production, and when you come to scale a lot - you can
> use varnish/ESI straight away, just by changing config - rather than needing
> to rework parts of your app. :)

Okay, this really makes Varnish/ESI an attractive route and we'll
definitely aim at taking it in the not so distant future :)

Meanwhile, I played with Template::Plugin::Cache which unfortunately
has problems with UTF-8 content and Memcached because the UTF-8 flag
is not properly restored on get(). Should be easy to fix with
something like: Encode::_utf8_on( $result );

It would be awesome if TT allowed something like this:

[% CACHE key => 'latest-stories' ttl => '3600' %]
  ... Expensive stuff ...
[% END %]

Or something similar to Mason's cache_self() method.

But these are different discussions for different mailing lists :)

Thanks for your advice!


More information about the Catalyst mailing list