From: Evan Prodromou Date: Mon, 4 Jan 2010 19:57:48 +0000 (-1000) Subject: Differentiate between empty values and cache misses in CacheLogPlugin X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=928b5f8f2be554c37b0a435e76e88e92260e667b;p=quix0rs-gnu-social.git Differentiate between empty values and cache misses in CacheLogPlugin --- diff --git a/plugins/CacheLogPlugin.php b/plugins/CacheLogPlugin.php index 9eb04641e6..f1e5dd83aa 100644 --- a/plugins/CacheLogPlugin.php +++ b/plugins/CacheLogPlugin.php @@ -61,7 +61,7 @@ class CacheLogPlugin extends Plugin function onEndCacheGet($key, &$value) { - if (is_null($value)) { + if ($value === false) { $this->log(LOG_INFO, "Cache MISS for key '$key'"); } else { $this->log(LOG_INFO, "Cache HIT for key '$key'"); @@ -71,7 +71,21 @@ class CacheLogPlugin extends Plugin function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) { - $this->log(LOG_INFO, "Setting cache value for key '$key'"); + if (empty($value)) { + if (is_array($value)) { + $this->log(LOG_INFO, "Setting empty array for key '$key'"); + } else if (is_null($value)) { + $this->log(LOG_INFO, "Setting null value for key '$key'"); + } else if (is_string($value)) { + $this->log(LOG_INFO, "Setting empty string for key '$key'"); + } else if (is_integer($value)) { + $this->log(LOG_INFO, "Setting integer 0 for key '$key'"); + } else { + $this->log(LOG_INFO, "Setting empty value '$value' for key '$key'"); + } + } else { + $this->log(LOG_INFO, "Setting non-empty value for key '$key'"); + } return true; }