aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/console/common.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2015-03-22 21:00:41 +1300
committerAldo Cortesi <aldo@nullcube.com>2015-03-22 21:00:41 +1300
commit842e23d3e386169d9a90cef2a634c55a3e5fdd8e (patch)
tree4932fa82faf92d36fbe7a8d56741a892c7003119 /libmproxy/console/common.py
parenta2da38cc8339887abef4efa23cc54fa02c981f3f (diff)
downloadmitmproxy-842e23d3e386169d9a90cef2a634c55a3e5fdd8e.tar.gz
mitmproxy-842e23d3e386169d9a90cef2a634c55a3e5fdd8e.tar.bz2
mitmproxy-842e23d3e386169d9a90cef2a634c55a3e5fdd8e.zip
Replace far-too-clever decorator LRU cache with something simpler
Diffstat (limited to 'libmproxy/console/common.py')
-rw-r--r--libmproxy/console/common.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/libmproxy/console/common.py b/libmproxy/console/common.py
index a0590bb1..2f143f01 100644
--- a/libmproxy/console/common.py
+++ b/libmproxy/console/common.py
@@ -327,11 +327,7 @@ def ask_save_body(part, master, state, flow):
signals.status_message.send(message="No content to save.")
-class FlowCache:
- @utils.LRUCache(200)
- def format_flow(self, *args):
- return raw_format_flow(*args)
-flowcache = FlowCache()
+flowcache = utils.LRUCache(800)
def format_flow(f, focus, extended=False, hostheader=False, padding=2):
@@ -370,6 +366,7 @@ def format_flow(f, focus, extended=False, hostheader=False, padding=2):
d["resp_ctype"] = t[0].split(";")[0]
else:
d["resp_ctype"] = ""
- return flowcache.format_flow(
+ return flowcache.get(
+ raw_format_flow,
tuple(sorted(d.items())), focus, extended, padding
)