Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2@file
3@brief Caching functions
4"""
7def install_memoize(f):
8 """
9 cache a downloaded page
10 """
11 memo = {}
13 def helper(x):
14 if x not in memo:
15 memo[x] = f(x)
16 return memo[x]
17 return helper
20def install_memoize2(f):
21 """
22 cache a downloaded page
23 """
24 memo = {}
26 def helper(x, is406=False):
27 if x not in memo:
28 memo[x] = f(x, is406)
29 return memo[x]
30 return helper