Memcache and Smarty
rob.sharp at thesoundalliance.net
Mon Sep 10 07:50:24 UTC 2007
On Mon, 2007-09-10 at 14:24 +0800, J A wrote:
> I've read that it's not good to use Memcache to cache MySQL queries,
> as the MySQL buffer already does this. Instead, I should cache the
> html output. Is this what one should always do?
MySQL does indeed cache query data, but I believe this gets invalidated
when the table is updated. We use ADODB as an abstraction layer, and
this allows easy memcaching of query results out of the box.
> I'm running PHP and using Smarty for templates. The PHP throws the
> output to Smarty, and Smarty is the thing that outputs the html. Thus
> my application is not able to grab the html output. Or is there a way
> to do it?
You might like to investigate basic Smarty caching using the filesystem,
unless theres a particular reason you need to use memcache. It would be
reasonably simple to adapt Smarty filecaching to memcache, however.
> For instance, in a page I might have a "about us" section, a "friends
> list", and a "blog list". I'd like to cache each of those sections.
Smarty will compile each of these sections individually and then cache
the page as a whole. There's not currently (AFAIK) template-level
caching in Smarty, but one of my co-workers has a working implementation
that we're testing.
Hope that helps a little,
telephone: 02 9282 4038
facsimile: 02 9282 4099
inthemix : FasterLouder : Thought By Them : SameSame
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the memcached