I have sections on a page that require enough resources that I would like to cache, here is an example page.
[=== Some Static HTML ===]
[=== PHP 1 ===]
[=== Some Static HTML ===]
[=== PHP 2 ===]
I would like to put "PHP Script 1" in a cache file, such as script1.html, and include it, rather than processing entire scripts and the same for Script 2.
I have a problem: I can easily cache the entire page and work, but I would just like to cache certain parts (as indicated above), because some things, such as user session data, must be in real time.
I have this class that is designed to stop and start the buffer so that I can pull out certain parts without disturbing the rest of the page, however it does not do what I want.
http://pastebin.com/Ua6DDExw
I would like to be able to go as shown below, while it will store the section in a file with simple php inlcude, rather than hitting the database.
HTML Content
<?php
$cache->start_buffer("cache_name");
$cache->end_buffer("cache_name");
?>
HTML Content
<?php
$cache->start_buffer("cache_name");
$cache->end_buffer("cache_name");
?>
I do not have access to memcache or the like, because this will happen on shared hosting.
Any help would be great, Thanks
source
share