mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-01-31 04:13:49 +01:00
cache bug
This commit is contained in:
parent
20e8d47ee8
commit
df0813e9d8
@ -14,12 +14,11 @@
|
|||||||
public static function get($key) {
|
public static function get($key) {
|
||||||
global $config, $debug;
|
global $config, $debug;
|
||||||
|
|
||||||
if(!self::$cache)
|
|
||||||
self::init();
|
|
||||||
|
|
||||||
$data = false;
|
$data = false;
|
||||||
switch($config['cache']['enabled']) {
|
switch($config['cache']['enabled']) {
|
||||||
case 'memcached':
|
case 'memcached':
|
||||||
|
if(!self::$cache)
|
||||||
|
self::init();
|
||||||
$data = self::$cache->get($key);
|
$data = self::$cache->get($key);
|
||||||
break;
|
break;
|
||||||
case 'apc':
|
case 'apc':
|
||||||
@ -40,14 +39,13 @@
|
|||||||
public static function set($key, $value, $expires = false) {
|
public static function set($key, $value, $expires = false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if(!self::$cache)
|
|
||||||
self::init();
|
|
||||||
|
|
||||||
if(!$expires)
|
if(!$expires)
|
||||||
$expires = $config['cache']['timeout'];
|
$expires = $config['cache']['timeout'];
|
||||||
|
|
||||||
switch($config['cache']['enabled']) {
|
switch($config['cache']['enabled']) {
|
||||||
case 'memcached':
|
case 'memcached':
|
||||||
|
if(!self::$cache)
|
||||||
|
self::init();
|
||||||
self::$cache->set($key, $value, $expires);
|
self::$cache->set($key, $value, $expires);
|
||||||
break;
|
break;
|
||||||
case 'apc':
|
case 'apc':
|
||||||
@ -61,11 +59,10 @@
|
|||||||
public static function delete($key) {
|
public static function delete($key) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if(!self::$cache)
|
|
||||||
self::init();
|
|
||||||
|
|
||||||
switch($config['cache']['enabled']) {
|
switch($config['cache']['enabled']) {
|
||||||
case 'memcached':
|
case 'memcached':
|
||||||
|
if(!self::$cache)
|
||||||
|
self::init();
|
||||||
self::$cache->delete($key);
|
self::$cache->delete($key);
|
||||||
break;
|
break;
|
||||||
case 'apc':
|
case 'apc':
|
||||||
@ -79,14 +76,13 @@
|
|||||||
public static function flush() {
|
public static function flush() {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if(!self::$cache)
|
|
||||||
self::init();
|
|
||||||
|
|
||||||
switch($config['cache']['enabled']) {
|
switch($config['cache']['enabled']) {
|
||||||
case 'memcached':
|
case 'memcached':
|
||||||
|
if(!self::$cache)
|
||||||
|
self::init();
|
||||||
return self::$cache->flush();
|
return self::$cache->flush();
|
||||||
case 'apc':
|
case 'apc':
|
||||||
return apc_clear_cache();
|
return apc_clear_cache('user');
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -947,8 +947,8 @@
|
|||||||
|
|
||||||
if($mute['time'] + $mutetime > time()) {
|
if($mute['time'] + $mutetime > time()) {
|
||||||
if($config['cache']['enabled']) {
|
if($config['cache']['enabled']) {
|
||||||
cache::set("mute_${_SERVER['REMOTE_ADDR']}", $mute, $mute['time'] + $mutetime);
|
cache::set("mute_${_SERVER['REMOTE_ADDR']}", $mute, $mute['time'] + $mutetime - time());
|
||||||
cache::set("mutetime_${_SERVER['REMOTE_ADDR']}", $mutetime, $mute['time'] + $mutetime);
|
cache::set("mutetime_${_SERVER['REMOTE_ADDR']}", $mutetime, $mute['time'] + $mutetime - time());
|
||||||
}
|
}
|
||||||
// Not expired yet
|
// Not expired yet
|
||||||
error(sprintf($config['error']['youaremuted'], $mute['time'] + $mutetime - time()));
|
error(sprintf($config['error']['youaremuted'], $mute['time'] + $mutetime - time()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user