Forum Moderators: coopster
I want to cache the responses produced by PHP for XMLHttp request. So I configured Apache mod_cache. The mod_cache could cache some web pages or javascripts. However, it could not work for the dynamic responses for XMLHttp request. I really do not know whether it is some error on my configuration or my PHP script. So I just post some of the PHP script here, which is relative to cache. Could you help me to analyze it? Thanks.
For mod_cache, I use httpd.conf to configure it:
MaxKeepAliveRequests 10000
<IfModule mpm_winnt.c>
ThreadsPerChild 1900
MaxRequestsPerChild 10000
</IfModule>
LoadModule cache_module modules/mod_cache.so
<IfModule mod_cache.c>
CacheForceCompletion 100
CacheDefaultEXPire 3600
CacheMaxExpire 86400
CacheLastModifiedFactor 0.1
LoadModule disk_cache_module modules/mod_disk_cache.so
<IfModule mod_disk_cache.c>
CacheEnable disk /
CacheRoot c:/cacheroot
CacheSize 327680
CacheDirLength 4
CacheDirLevels 5
CacheGcInterval 4
</IfModule>
#LoadModule mem_cache_module modules/mod_mem_cache.so
<IfModule mod_mem_cache.c>
CacheEnable mem /
MCacheSize 8192
MCacheMaxObjectCount 10000
MCacheMinObjectSize 1
MCacheMaxObjectSize 51200
</IfModule>
</IfModule>
On client, I use ajax technology and XMLHttpRequest and on server, I use php script.
...
header("Cache-Control: public"); // HTTP/1.1
header("Expires: " .gmdate ("D, d M Y H:i:s", time() + 60 * 10). " GMT");
header( "Last-Modified: " .gmdate( 'D, d M Y H:i:s' ). " GMT" );
echo $response;
....
[webmasterworld.com...]
[webmasterworld.com...]
[webmasterworld.com...]
[webmasterworld.com...]
Regards
Michal