diff --git a/core/cacheengine.php b/core/cacheengine.php index 862bbf1f..b2a4acc6 100644 --- a/core/cacheengine.php +++ b/core/cacheengine.php @@ -188,14 +188,11 @@ class Cache public function get(string $key) { - global $_tracer; - $_tracer->begin("Cache Query", ["key"=>$key]); + global $_tracer; + $_tracer->begin("Cache Query", ["key"=>$key]); $val = $this->engine->get($key); - if ((DEBUG_CACHE === true) || (is_null(DEBUG_CACHE) && @$_GET['DEBUG_CACHE'])) { - $hit = $val === false ? "hit" : "miss"; - file_put_contents("data/cache.log", "Cache $hit: $key\n", FILE_APPEND); - } - $_tracer->end(); + $hit = $val === false ? "hit" : "miss"; + $_tracer->end(null, ["result"=>$hit]); if ($val !== false) { $this->hits++; return $val; @@ -207,18 +204,18 @@ class Cache public function set(string $key, $val, int $time=0) { + global $_tracer; + $_tracer->begin("Cache Set", ["key"=>$key, "time"=>$time]); $this->engine->set($key, $val, $time); - if ((DEBUG_CACHE === true) || (is_null(DEBUG_CACHE) && @$_GET['DEBUG_CACHE'])) { - file_put_contents("data/cache.log", "Cache set: $key ($time)\n", FILE_APPEND); - } + $_tracer->end(); } public function delete(string $key) { + global $_tracer; + $_tracer->begin("Cache Delete", ["key"=>$key]); $this->engine->delete($key); - if ((DEBUG_CACHE === true) || (is_null(DEBUG_CACHE) && @$_GET['DEBUG_CACHE'])) { - file_put_contents("data/cache.log", "Cache delete: $key\n", FILE_APPEND); - } + $_tracer->end(); } public function get_hits(): int diff --git a/core/sys_config.php b/core/sys_config.php index 06e9e900..d3ed2761 100644 --- a/core/sys_config.php +++ b/core/sys_config.php @@ -30,7 +30,6 @@ _d("DATABASE_KA", true); // string Keep database connection alive _d("DATABASE_TIMEOUT", 10000);// int Time to wait for each statement to complete _d("CACHE_DSN", null); // string cache connection details _d("DEBUG", false); // boolean print various debugging details -_d("DEBUG_CACHE", false); // boolean dump cache queries to data/cache.log _d("COVERAGE", false); // boolean activate xdebug coverage monitor _d("CACHE_HTTP", false); // boolean output explicit HTTP caching headers _d("COOKIE_PREFIX", 'shm'); // string if you run multiple galleries with non-shared logins, give them different prefixes