Funky Cache for Frog CMS

Blog Projects
PHP Frog

Note! I do not maintain this plugin anymore. For latest version check Martijn van der Kleijn’s GitHub repository.

Funky Cache plugin for Frog CMS. I can make your site withstand Digg effect and Slashdotting at the same time.

Funky Cache is a plugin for Frog CMS. It can make your site withstand Digg effect and Slashdotting at the same time. Content is cached as static file on the first access. All following requests are served by webserver using the cached static file. Cached request never reaches the PHP backend. Editing a page will automatically expire cached files. Page is then re-cached on the next hit.

Speed

Following chart show number of requests per second on a test server. Three bars represent Frog installation with no caching, with File Cache plugin installed and with Funky Cache plugin installed. More accurate numbers in speed comparison blog post.

Install

Copy files to frog/plugins/funky_cache/ folder. If you do not have access to git download zip or tarball from GitHub. GitHub tarball generation seems to be broken. Use this download link instead. Local installation file might come bit behind GitHub. So if you want bleeding edge use git clone.

cd frog/plugins/
git clone git://github.com/tuupola/frog_funky_cache.git funky_cache

Open you config.php and make sure the following is set:

define('USE_MOD_REWRITE', true);

Got to admin and enable Funky Cache plugin.

Reload the admin page to see “Cache” tab appear. Click on the tab to check your settings.

Cache file suffix is important! It is the suffix of static files written to disk. It should be the same as URL_SUFFIX in Frog config.php. If your URL_SUFFIX is empty cache file suffix will default to .html.

Cache folder is the folder where static files are written. Folder is related to document root. If you leave this empty cached files will be written to document root. Webserver must have write access to cache folder.

Go to shell and create the cache folder and give write access to it.

>cd path/to/document/root/
>mkdir cache
>chmod a+w cache

Funky Cache depends on correctly setup mod_rewrite rules. Rules are different depending on your Frog and plugin settings. Click “Your .htaccess file” on sidebar. Cut and paste given code to .htaccess file in your document root.

Usage

When all is set browse few pages on your site. You can see list of cached pages by clicking cache tab. Cache is expired automatically when you edit a page. Whole cache is cleared when you add or delete a page. This is to make sure navigation elements on other pages do not become stale.

You can also manually clear the cache by clicking clear all button.

You can set whether individual page should be cached or not when editing a page.

Known Issues

Plugin has been tested and known to work with Archive plugin. Comments plugin seems to work but has not been tested. It is know not to work with Paging helper. It is all in the TODO list…



When asking a question please include an URL to example page where the problem occurs. If you have longer code examples please use pastie.org.
CATEGORIES
Built using the awesome Flat UI Pro framework by Designmodo.

© 2013 Mika Tuupola.