RE: [PHP] Cacheing data form PHP script
| From: | daniel at electroteque dot org | Date: | Thu, 29 Jan 2004 00:24:25 +0000 |
| Subject: | RE: [PHP] Cacheing data form PHP script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-176148@lists.php.net to get a copy of this message | ||
> It's not really that bad, maybe I just made it sound complicated and
> annoying.
>
> (pseudo-php)
>
> If (dataexistsindb) {
> $cachedata = SELECT cachedata from DB
> $dataarr = unserialize(cachedata)
> } else {
> $dataarr = SELECT freshdata
> $cachedata = serialize($dataarr)
> INSERT or UPDATE $cachedata into DB
> // INSERT if you want to keep a history of cachedata
> // UPDATE or I guess REPLACE if you want to keep just one copy of
> the cache
> }
>
> If you make changes during the day and/or to just do another
> UPDATE/REPLACE.. Either looking for the single record or the one with
> today's date on it.
>
Here is the issue, i have a seperate table for each menu, then the menu
gets generated which will return an ide to store into the parent table,
would string checking against the cache table for the table slow it down
like select * from cachetable where table='foo' ??