summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolderpunk <solderpunk@sdf.org>2020-09-01 23:11:55 +0200
committerSolderpunk <solderpunk@sdf.org>2020-09-01 23:11:55 +0200
commit67f9c662b3bde5e614a0e92ad14f37403aab5e99 (patch)
treee3010e3548916e15fbdbaaf6f72d32c194c57729
parent545d5f917d6f12a61d5156b486be58927038516e (diff)
Add option to disable caching.
-rwxr-xr-xav98.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/av98.py b/av98.py
index 02bfb68..dcd6659 100755
--- a/av98.py
+++ b/av98.py
@@ -274,6 +274,7 @@ class GeminiClient(cmd.Cmd):
"auto_follow_redirects" : True,
"gopher_proxy" : None,
"tls_mode" : "tofu",
+ "cache" : False
}
self.log = {
@@ -334,7 +335,7 @@ you'll be able to transparently follow links to Gopherspace!""")
return
# Use cache, or hit the network if resource is not cached
- if self._is_cached(gi.url):
+ if self.options["cache"] and self._is_cached(gi.url):
mime, body, tmpfile = self._get_cached(gi.url)
else:
try:
@@ -526,7 +527,8 @@ you'll be able to transparently follow links to Gopherspace!""")
self._debug("Wrote %d byte response to %s." % (size, self.tmp_filename))
# Maintain cache and log
- self._add_to_cache(gi.url, mime, tmpf.name)
+ if self.options["cache"]:
+ self._add_to_cache(gi.url, mime, tmpf.name)
self._log_visit(gi, address, size)
return gi, mime, body, tmpf