rcache: cleanup, upgrade path, config options (MDL-8163)

record cache and caching schemes get a little cleanup, faster
if()s and a nice set of config options. Users who've been using
the internal cache get a nice upgrade too.
This commit is contained in:
martinlanghoff 2007-01-14 23:02:13 +00:00
parent a5855a89bf
commit bb931a61c6
5 changed files with 77 additions and 17 deletions

View file

@ -207,6 +207,7 @@ global $HTTPSPAGEREQUIRED;
configure_dbconnection();
/// Load up any configuration from the config table
$CFG->rcache = false;
$CFG = get_config();
/// Turn on SQL logging if required
@ -267,11 +268,25 @@ global $HTTPSPAGEREQUIRED;
/// Shared-Memory cache init -- will set $MCACHE
/// $MCACHE is a global object that offers at least add(), set() and delete()
/// with similar semantics to the memcached PHP API http://php.net/memcache
if (!empty($CFG->memcached) && !empty($CFG->memcachedhosts)) {
init_memcached();
if (!empty($CFG->cachetype)) {
if ($CFG->cachetype === 'memcached' && !empty($CFG->memcachedhosts)) {
if (!init_memcached()) {
debugging("Error initialising memcached");
}
} elseif ($CFG->cachetype === 'eaccelerator') {
if (!init_eaccelerator()) {
debugging("Error initialising eaccelerator cache");
}
}
} else { // just make sure it is defined
$CFG->cachetype = '';
}
if (!empty($CFG->eaccelerator)) {
init_eaccelerator();
/// Ensure we define rcache - so we can later check for it
/// with a really fast and unambiguous $CFG->rcache === false
if (empty($CFG->rcache)) {
$CFG->rcache = false;
} else {
$CFG->rcache = true;
}
/// Set a default enrolment configuration (see bug 1598)