Results 1 to 6 of 6
Nov 22, 2004, 05:06 #1
- Join Date
- Feb 2004
- 0 Post(s)
- 0 Thread(s)
Best way to store semi static variables?
Hi. this must be quite a common problem...
Say i have a list of categories (or something like that) which i want to display on all pages of a site which a user will visit.
Now my list is stored in my database and although it will/can change, it is very unlikely to change very often. So ideally, i dont want to have to fetch the data from a database everytime the user loads a page. so what is the best way of going about this?
i have come up with the following possible solutions:
This is probibly the best way to go about doing it...but unfortunately i dont know much about server side caching and have been too lazy to really get into it (maybe i should).
If anyone would like to give an explanation of caching and an example, that would be nice . Please also note that i dont want to go the PEAR cache route..
2.) Manually (or automatically) updating an included html file when categories are added. -> build this into the CMS / site administration.
3.) Storing the variables in a $_SESSION, so you only read in the list of categories once per users' session. Although obviosly this method will be a bit dodgy for people who dont have sessions enabled in their browsers.
in ASP one can use the application variable for this type of storage...
Im sure im not the first to come across this problem. what is the standard way of doing it? does anyone have any ideas which i might not have mentioned?