From 333809bea4b0ee8386db1464c90ee9a2cb95569d Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Wed, 13 Jan 2021 13:36:17 +0100 Subject: give error keys on apc failures --- it_cache.class | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/it_cache.class b/it_cache.class index da5114f..7c5816f 100644 --- a/it_cache.class +++ b/it_cache.class @@ -83,12 +83,12 @@ static function put($key, $value, $p = array()) if ($p['distributed'] && ($memcache = it_cache::_get_memcache($p))) $success = @$memcache->set($key, $value, $p['ttl']); else - $success = ($func = self::$_store_func) ? $func($key, $value, $p['ttl']) : null; + $success = !count(($func = self::$_store_func) ? ($errors = $func([$key => $value], null, $p['ttl'])) : ['noapcu']); if (!$success && $p['safety'] == 1) it::error(array_filter([ 'title' => ($p['distributed'] ? "memcache (" . ($memcache ? ($memcache->getResultMessage() . " on " . $memcache->getServerByKey($key)['host']) : "n/a") . ")" : self::$_store_func) . " in it_cache::put failed", - 'body' => "key='$key'", + 'body' => ['key' => $key, 'errors' => $errors], 'id' => $p['distributed'] ? "it_cache_fail_" . $memcache->getServerByKey($key)['host'] : "it_cache_fail", 'timewindow' => "1200-1300", 'blockmailid' => $memcache ? "memcache_on_" . $memcache->getServerByKey($key)['host'] : null, -- cgit v1.2.3