summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/cache.php22
-rw-r--r--inc/functions.php4
2 files changed, 11 insertions, 15 deletions
diff --git a/inc/cache.php b/inc/cache.php
index 8909deaf..3546e031 100644
--- a/inc/cache.php
+++ b/inc/cache.php
@@ -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;
diff --git a/inc/functions.php b/inc/functions.php
index af45c014..95f1216f 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -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()));