=== WP Plugin Cache === Contributors: dartiss Donate link: http://bit.ly/cGzaRQ Tags: WordPress, Plugin, Cache, Developer Requires at least: 2.0.0 Tested up to: 2.9.2 Stable tag: 1.0 WP Plugin Cache provides a file caching facility for any plugin that wishes to interface with it. == Description == WP Plugin Cache was designed to provide developers with an easy to use cache system that they could integrate into their plugins. Now, even the smallest and simplest plugin can use a caching system! If you're not a developer, you may be asked to install this plugin to add caching features to a plugin. Having a seperate caching facility ensures efficient use of code and, ultimately, improved performance. However, performance improvements are always down to how any developer implements this plugin - hints and tips are provided throughout the instructions. == Usage == Unless you're a developer, wishing to use this plugin to compliment one of your own, there's no need to read any further! If you are, read on... When activated, the plugin creates a folder in your wp-contents/uploads directory named plugin_cache. This will store any cached files. The main functions to be aware of are `plugin_cache_read` and `plugin_cache_update`. The read and updating functions are seperate to allow for the files to be "stripped down" before being saved, allowing for improved performance. However, if changes are not necesssary then the `plugin_cache_read` function can perform the entire caching procedure by itself. `plugin_cache_read` has 3 parameters... **file key** - This is a unique key to identify the cached file. Often, just the filename would be sufficient, but if you need to differentiate between different versions of the same filename (e.g. a news feed which may contain different numbers of entries) then extra data can be added. **filename** - This is the filename of the file that you wish to read if a cache doesn't exist. This is optional - if no cache is found and a filename hasn't been specified, then nothing will be returned by the function. This allows you to fetch the file yourself. **timeout** - This is the number of hours after which you wish the cache to be updated. Specifying this causes the function to also perform the same processing as `plugin_cache_update`. So, specifying a filename but NOT a timeout will cause the file to be fetched - either from cache or not. Specifying a timeout and a filename will mean that the file will be fetched and then updated in the cache. The function will return an array containing the following data... **cache_update** - Does the cache need updating? This is relevant if you are using the `plugin_cache_update` function, as you can use it to determine whether you need to call it or not. It contains either `Y` or blank. **data** - This is the returned file contents. If it was not fetched from cache and you did not specify a filename, then this will be blank. An example of usage would be... `$return=plugin_cache_read("test","http://www.artiss.co.uk/feed",3);` This would fetch the feed from my site, updating the cache and giving it a timeout of 3 hours. `plugin_cache_update` has 3 parameters, none of which are optional. The first and third are identical to those used in `plugin_cache_read'. The second parameter, however, is not a filename but the file contents instead. An example would be... `$return=plugin_cache_update("test",$data,3);` This would update the cache with the contents of `$data` for 3 hours. == Debugging == If the cache does not appear to be working, then there is a way of debugging it. After calling the `plugin_cache_read` or `plugin_cache_update` function, you can call a function named `plugin_cache_debug`. The only parameter is the output array from the `plugin_cache_read` or `plugin_cache_update` function. For example, let's say you call `plugin_cache_read` in the following way... `$return=plugin_cache_read("test","http://www.artiss.co.uk/feed",3);` In this case, you can display the debug information via the following function call... `plugin_cache_debug($return);` == Installation == 1. Upload the entire wp-plugin-cache folder to your wp-content/plugins/ directory. 2. Activate the plugin through the ‘Plugins’ menu in WordPress. 3. That's it - there's no admin screen! == Frequently Asked Questions == = How can I get help or request possible changes = Feel free to report any problems, or suggestions for enhancements, to me either via [my contact form](http://www.artiss.co.uk/contact "Contact Me") or by [the plugins homepage](http://www.artiss.co.uk/wp-plugin-cache "WP Plugin Cache"). == Changelog == = 1.0 = * Initial release == Upgrade Notice == = 1.0 = * Initial release