[thelist] Caching: PHP or Clientside?

Matt Warden mwarden at gmail.com
Thu Sep 23 00:59:11 CDT 2004

On Thu, 23 Sep 2004 00:59:46 -0400, Mr. Tenuta <dtportnoy at videotron.ca> wrote:
> I'm caching a huge chunk of html output and am debating where to put it. Would it be efficient to store that code in a PHP variable and carry that variable throughout every page?
> Should I store it clientside? If so how do I store all that data? In a cookie?

That probably won't work, if it's really a "huge chunk of html."
Cookies have a size limit. I believe it is 4Kb.

> PHP variable or Clientside? which would be more efficient. I'm just not sure if it's bad programming carrying a bunch of output from page to page. (of course with sessions)

Nothing wrong with using sessions, assuming your server's memory is
large enough to handle the load (# bytes of html * average # users).
It will certainly be better than not caching.

By the way, I assume the reason you are caching is because it takes a
good bit to process and come up with the output of this html.

I don't believe PHP has an equivalent, but in ASP there is an
Application object, where one could store a single copy of a variable
and have it available to all sessions. You might want to look into
whether PHP has something similar. Obviously t his will only work if
there aren't any personalization (session-specific) content in the

Matt Warden
Miami University
Oxford, OH

This email proudly and graciously contributes to entropy.

More information about the thelist mailing list