changeset 19715:6800db9f3aa9

auth: If auth cache lookup results in expired entry, it should be tracked in stats as a "miss"
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Fri, 05 Feb 2016 15:48:25 +0200
parents e3bc345e00ea
children bb80600fe293
files src/auth/auth-cache.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-cache.c	Fri Feb 05 15:26:15 2016 +0200
+++ b/src/auth/auth-cache.c	Fri Feb 05 15:48:25 2016 +0200
@@ -373,7 +373,6 @@
 		cache->miss_count++;
 		return NULL;
 	}
-	cache->hit_count++;
 
 	value = node->data + strlen(node->data) + 1;
 	ttl_secs = *value == '\0' ? cache->neg_ttl_secs : cache->ttl_secs;
@@ -381,6 +380,7 @@
 	now = time(NULL);
 	if (node->created < now - (time_t)ttl_secs) {
 		/* TTL expired */
+		cache->miss_count++;
 		*expired_r = TRUE;
 	} else {
 		/* move to head */
@@ -388,6 +388,7 @@
 			auth_cache_node_unlink(cache, node);
 			auth_cache_node_link_head(cache, node);
 		}
+		cache->hit_count++;
 	}
 	if (node->created < now - (time_t)cache->neg_ttl_secs)
 		*neg_expired_r = TRUE;