Enable the cache only if you really need it, as it may make
things worse for your blog and your service provider. Similarly to other cache engines,
this cache works by storing a copy of each page in the filesystem, with an additional copy for each identified user (eg having a WordPress
or LightPress cookie set). The stored pages expire after a certain amount of time (validity set below), but
they are phisically removed from the filesystem after expiration only when the garbage collector runs (gc_probability set below).
This means that if you have a high traffic blog, lots of posts, and many identified users (people who at some time have posted a comment on your blog),
you will end up with lots of cache files, most of which will be only marginally useful. Your blog will be slower for most users, the
filesystem will be full of unneeded junk, and your service provider will most likely become mad at you.
A few cases where caching might be useful are when
one of your posts is or might get slashdotted (many anonymous visitors requesting a few pages in a short time)
lots of anonymous users frequently request your index page to check for updates
If you have one of the above situations, try to enable caching (we have made it a manual process so you will not
enable it by mistake), set the appropriate inclusions/exclusions (eg in the examples above
only include the posts which might get slashdotted, and/or the index page), and monitor your server load and your filesystem usage to see if it really helps.
Caching is not yet enabled for feeds as they already use Conditional GET. We will add feeds support in one of the next releases.
please check the folder where you have install LightPress, then set (and save) required options';
} else if (!$ret || !class_exists('LightPressCache')) {
// if we ever have more than one cache classes, we will need to change this
echo class_exists('LightPressCache') . '
Cache class not found
';
} else {
// ugly code following, replace with something more modular
$lp_cache_args = get_option('lp_opt_cache_args');
$lp_base_url = parse_url(get_option('lp_opt_url'));
if (isset($lp_base_url['path']))
$lp_cache_base_path = $lp_base_url['path'] . '/';
else
$lp_cache_base_path = '/';
if (!is_array($lp_cache_args)) {
$lp_cache_args = array();
$lp_cache_args['base_path'] = $lp_cache_base_path;
}
$lp_opt_cache_actions_enabled = get_option('lp_opt_cache_actions_enabled');
$lp_opt_cache_actions_all_pages = get_option('lp_opt_cache_actions_all_pages');
$lp_cache =& new LightPressCache($lp_cache_args, true);
foreach ($lp_cache->constructor_args as $k)
$lp_cache_args[$k] = $lp_cache->$k;
if (isset($_POST['lp_action'])) {
if (isset($_POST['lp_opt_cache_actions_enabled']))
$lp_opt_cache_actions_enabled = $_POST['lp_opt_cache_actions_enabled'];
else
$lp_opt_cache_actions_enabled = 0;
$lp_opts->updateOption('lp_opt_cache_actions_enabled', $lp_opt_cache_actions_enabled);
if (isset($_POST['lp_opt_cache_actions_all_pages']))
$lp_opt_cache_actions_all_pages = $_POST['lp_opt_cache_actions_all_pages'];
else
$lp_opt_cache_actions_all_pages = 0;
$lp_opts->updateOption('lp_opt_cache_actions_all_pages', $lp_opt_cache_actions_all_pages);
if (!isset($_POST['lp_cache_arg_track_users']))
$_POST['lp_cache_arg_track_users'] = '0';
$lp_cache_args_modified = false;
foreach ($_POST as $k=>$v) {
if (strpos($k, 'lp_cache_arg_') === 0) {
$lp_cache_args_modified = true;
$lp_cache_args[substr($k, 13)] = $v;
}
}
if ($lp_cache_args_modified) {
$lp_cache_args['base_path'] = $lp_cache_base_path;
$lp_opts->updateOption("lp_opt_cache_args", $lp_cache_args);
}
$lp_cache_args = get_option('lp_opt_cache_args');
}
echo '';
echo '\n";
}
?>