cache bug

This commit is contained in:
Savetheinternet 2011-10-09 04:35:50 +11:00
parent 20e8d47ee8
commit df0813e9d8
2 changed files with 11 additions and 15 deletions

View File

@ -14,12 +14,11 @@
public static function get($key) {
global $config, $debug;
if(!self::$cache)
self::init();
$data = false;
switch($config['cache']['enabled']) {
case 'memcached':
if(!self::$cache)
self::init();
$data = self::$cache->get($key);
break;
case 'apc':
@ -40,14 +39,13 @@
public static function set($key, $value, $expires = false) {
global $config;
if(!self::$cache)
self::init();
if(!$expires)
$expires = $config['cache']['timeout'];
switch($config['cache']['enabled']) {
case 'memcached':
if(!self::$cache)
self::init();
self::$cache->set($key, $value, $expires);
break;
case 'apc':
@ -61,11 +59,10 @@
public static function delete($key) {
global $config;
if(!self::$cache)
self::init();
switch($config['cache']['enabled']) {
case 'memcached':
if(!self::$cache)
self::init();
self::$cache->delete($key);
break;
case 'apc':
@ -79,14 +76,13 @@
public static function flush() {
global $config;
if(!self::$cache)
self::init();
switch($config['cache']['enabled']) {
case 'memcached':
if(!self::$cache)
self::init();
return self::$cache->flush();
case 'apc':
return apc_clear_cache();
return apc_clear_cache('user');
}
return false;

View File

@ -947,8 +947,8 @@
if($mute['time'] + $mutetime > time()) {
if($config['cache']['enabled']) {
cache::set("mute_${_SERVER['REMOTE_ADDR']}", $mute, $mute['time'] + $mutetime);
cache::set("mutetime_${_SERVER['REMOTE_ADDR']}", $mutetime, $mute['time'] + $mutetime);
cache::set("mute_${_SERVER['REMOTE_ADDR']}", $mute, $mute['time'] + $mutetime - time());
cache::set("mutetime_${_SERVER['REMOTE_ADDR']}", $mutetime, $mute['time'] + $mutetime - time());
}
// Not expired yet
error(sprintf($config['error']['youaremuted'], $mute['time'] + $mutetime - time()));