OK, for my forums the number one slow down source (its like .1-3 seconds but hey) is from my template function. It's simple, but it looses time because it includes the actual tempalte (stored as a flat file) every time its used, and when I do things like get the threads for a forum i end up looping the template function and stuff, so I need to cache the template files if possible.

Also, I currently 'cache' (i use this in a loose sense )
* The color scheme for the user
* Array of 'marked posts' (the dotted ones. I get the array the first time i load a forum and then 'cache' it - the cached array is multidimensional - $_SESSION['markedPosts'][forumID][topicID] = true
*The post/topic display templates (because they are used the must - whenever you view a thread, and for each and every post)

Anyways, I'm basically caching things in a session right now.

Since I'll be releasing this forum, I have the default PHP installation to work with - I can't install any extra programs onto the HD, I need to be aware of possible safe_mode restrictions,etc.

These are my ideas:

* Stick cache in DB, putting a slightly heavier load on the database - of course, being a forum, the DB can make or break the app

* Continue with sessions (currently default, but I might possibly switch it to DB based later - not sure). I'm worried about lots of big (as in like 10-20kb, from templates) files tho

* Some sort of client-side cache would be the best, but I honestly don't know how - I'm worried if I put a cache header it would cache some things that shouldn't be cached - some of the more dynamic things (whose online, total posts, etc). I don't know if a huge cookie would work either

* Dont cache anything

There might be other ways, thats just what I thought of. I would like tips on which way to chose, possible other options, anything related to caching that I could pull off, whatever.


edit - safe mode question, almost forgot

say I'm in directory
public_html/forums/adm/page.php
and I want to edit
public_html/forums/templates/TEMPALTE_DIR/template.abb

I think I could do it with '../templates/TEMPLATE_DIR/template.abb' with safe mode off but would that work with it on? And if not, can I get around it somehow?

Thanks guys!