AJAX Cache acts much like imagecache by generating the result of a request on demand and storing it on the filesystem for later reuse. This is useful if you are trying to scale a site that makes many dynamic ajax calls. AJAX cache saves results directly to the files so the web server can serve them directly, rather then bootstrapping Drupal.
AJAX Cache will do nothing by itself. Supporting code must call it.
How to use
First you define the presets you are going to use like this:
/**
* Test implementation of hook_ajaxcache_presets().
*/
function ajaxcache_ajaxcache_presets() {
return array(
'test' => array(
// Name of your function that outputs the data to be cached
'callback' => 'ajaxcache_test_callback',
// Optional: include file where the callback is located.
// 'file' => 'include.inc',
// Optional: file extension to be used when serving the file. Defaults to html.
// 'extension' => 'json',
// Optional: file name (without extension) to be used when serving the file. Defaults to ajax.
// 'filename' => 'test',
),
);
Then, instead of passing javascript the URL that would point to your output function through the menu system, you pass the URL returned by:
ajaxcache_get_url($preset_name, $args);