Re: using APC as content-cache?
| From: | Ilia Alshanetsky | Date: | Fri, 29 Apr 2005 02:01:31 +0000 |
| Subject: | Re: using APC as content-cache? | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-2317@lists.php.net to get a copy of this message | ||
Storing complete cached pages in SHM is probably not for everyone since memory is fairly limited. MMcache for the most part stores the cached pages on disk, and only uses SHM for tracking purposes. The "cool" part comes in the fact it can store compressed version of the page so you get benefit of reduced network IO and in both cases sends caching headers.
Ilia
Interesting idea. Although it seems like it could be done almost completely in user-space, couldn't it? Perhaps something like this wrapper set as your auto_prepend?
$page_id = md5($_SERVER['REQUEST_URI']);
if(!$content = apc_fetch($page_id)) {
ob_start();
require $_SERVER['SCRIPT_FILENAME'];
$content = ob_end_clean();
apc_store($page_id, $content, 1800);
}
echo $content;
exit;
Would be interesting to see the performance numbers on this approach.
Then again, for full content-caching like this, a 404 handler which saves a static version of the content plus a cron job that periodically removes files older than 30 minutes might be even more effective. I would think that something like the above would be most effective when used in a partial page caching context.
-Rasmus