摘要:
1,Memoizing(自动缓存) 话不多说,看个例子。import time,hashlib,picklecache = {}def is_obsolete(entry,duration): return time.time() - entry['time'] > durationdef compute_key(function,args,kw): key = pickle.dumps((function.func_name,args,kw)) return hashlib.sha1(key).hexdigest()def memoize(duration=10): . 阅读全文