Fix broken cache.
diff --git a/src/cache.c b/src/cache.c
index b058582..f9ba335 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -394,7 +394,7 @@
   int freed_all = flags & F_REVERSE;
   int free_avail = 0;
 
-  if(daemon->max_cache_ttl < ttl)
+  if (daemon->max_cache_ttl != 0 && daemon->max_cache_ttl < ttl)
     ttl = daemon->max_cache_ttl;
 
   /* Don't log keys */