====== Smartcache Plugin ====== ---- plugin ---- description: Improve DokuWiki speed by smart usage of the browser cache author : Simon-Shlomo Poil email : simon.shlomo@poil.dk type : Action lastupdate : 2011-10-10 compatible : 2011-05-25 depends : conflicts : similar : tags : ajax, cache, javascript downloadurl: https://sourceforge.net/projects/dokusmartcache/files/latest/download bugtracker : http://sourceforge.net/p/dokusmartcache/tickets/ sourcerepo : http://sourceforge.net/p/dokusmartcache/code donationurl: ---- This plugin enable the browser cache for users that are not logged in. The cache is automatically refreshed (and checked) using an AJAX call to the server. If the user log in, the plugin also refresh the browser cache. You can see an example on how this plugin works here: [[http://www.youtube.com/watch?v=Ad2rO9vDoBk]] If you want to improve this plugin I would be very happy to add you as developer with read/write access on sourceforge. Please, contact me with your suggestions and comments. ===== Installation ===== Search and install the plugin using the [[plugin:extension|Extension Manager]] or manually with the download from the [[http://sourceforge.net/projects/dokusmartcache/files/smartcache.zip/download|SourceForge Mirror]]. Refer to [[:Plugins]] on how to install plugins manually. For some strange reason (anybody?), it is not possible to change the cache-headers using the event system. To get this plugin in to work you need to edit inc/actions.php: After the line : foreach ($headers as $hdr) header($hdr); insert: if(!isset( $_SERVER['REMOTE_USER'])){ header('Cache-Control: public, max-age='.max($conf['cachetime'], 2000000)); header('Pragma: cache'); } To speed up the AJAX code; you need to hardcode the 'datadir' path in the ajax.php script from the plugin folder. E.g., if your 'datadir' is '/var/www/data/pages/', you need to write: print date ("m/d/Y H:i:s",filemtime(('/var/www/data/pages/'.(str_replace(':','/',$_POST['id'])).'.txt'))); === Change Log === * **2011-08-01** * Initial release * **2011-10-10** * Fixed an issue that gave warning during searches ===== Known bugs ===== Sometimes (after changing any preferences in administration panel or other), the screen can reload indefinitly and the page never appear. To solve it : * disable smartcache ; e. g. : touch lib/plugins/smartcache/disabled * empty cache ; e. g. : rm data/cache/* * clear the cache in your browser (or all browsers) * enable smartcache ; e. g. : rm lib/plugins/smartcache/disabled Examples are unix commands, adapt them to your OS. ===== Removal ===== To uninstall smartcache plugin : * erase or disable smartcache plugin * delete or comment added lines in inc/actions.php * erase cache in data/cache (important) * eventually, erase cache of your browser ===== Discussion =====