Based on a PM about performance, I looked into adding Mod Rewrite caching to this plugin.
Attached is a first attempt at that if someone wants to try it.
I'm using it on my test site
http://testbed.cartocopia.com/ and it seems successful.
This version adds a new option titled "Create symlinks in the home directory to allow Mod Rewrite caching." (wordy, I know).
If this option is selected, when a cache file is created in the data/other/simplecache/ directory the plugin also creates a symlink in the GS root directory named
slug.html (for eample, the default page, having the slug "index" will generate a symlink named "index.html" pointed to the cache file.
To leverage this you need to:
1) set a custom permalink structure:
%slug%.html
2) change your .htaccess rewrite rules to use this structure, and add the check option. Below is mine:
Code:
AddDefaultCharset UTF-8
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#added the -l check for the cache symlinks
RewriteCond %{REQUEST_FILENAME} !-l
#for caching using custom permalink %slug%.html
RewriteRule ([A-Za-z0-9_-]+)[.]html index.php?id=$1 [QSA,L]
So what this does, is.. if a request comes in for a page like
http://testbed.cartocopia.com/disqus-test-page.html the web server rules will additionally check to see if there is no symlink with that name, and if not will throw it off to index.php to generate the page (and the cache file). If the cache file (and the link to it) already exist it just serves up the cached file directly via the symlink.
This should be much faster as the php process does not even get invoked.
The only "drawback" is that you cant regenerate cached files based on time accessing them this way, as php is not being called and Mod Rewrite can't do a check for file date. The only way to regenerate them the normal simplecache way is by accessing them via the index.php?id=slug URL or just deleting them from the back end maintenance page.
I'm sure more complicated adresses could be created, but that would require code changes to the plugin as it is hard-coded to save the files as
slug.html
Any thoughts on the usefulness/value of this? Not sure if I should update the version in extend...
-Rob A>