diff options
author | Solderpunk <solderpunk@sdf.org> | 2020-09-01 21:14:17 +0200 |
---|---|---|
committer | Solderpunk <solderpunk@sdf.org> | 2020-09-01 21:14:17 +0200 |
commit | 545d5f917d6f12a61d5156b486be58927038516e (patch) | |
tree | 1c02f3aee38c2dfc4fcf1b60361f3084599f6ce9 | |
parent | f45630450f6e7780de4b03c039beae98877e6bb6 (diff) |
Count cache hits in black box output.
-rwxr-xr-x | av98.py | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -288,6 +288,7 @@ class GeminiClient(cmd.Cmd): "refused_connections": 0, "reset_connections": 0, "timeouts": 0, + "cache_hits": 0, } self._connect_to_tofu_db() @@ -679,6 +680,7 @@ you'll be able to transparently follow links to Gopherspace!""") def _get_cached(self, url): mime, filename = self.cache[url] + self.log["cache_hits"] += 1 if mime.startswith("text/gemini"): with open(filename, "r") as fp: body = fp.read() @@ -1547,6 +1549,7 @@ current gemini browsing session.""" lines.append(("Timeouts:", self.log["timeouts"])) lines.append(("Refused connections:", self.log["refused_connections"])) lines.append(("Reset connections:", self.log["reset_connections"])) + lines.append(("Cache hits:", self.log["cache_hits"])) # Print for key, value in lines: print(key.ljust(24) + str(value).rjust(8)) |