datetime inspect inspect signatureParameter (fn): local_cache={} (*agrs**kwargs): clear_list= [] k(_stamp) local_cache.items(): star = datetime.datetime.now().timestamp() star - stamp >: clear_list.append(k) k clear_list: local_cache.pop(k) paramers_dict = {} sig = inspect.signature(fn) parameters = sig._parameters params_name = [key key parameters.keys()] ivalues (agrs): k = params_name[i] paramers_dict[k] = values kv kwargs.items(): paramers_dict[k] = v kv parameters.items(): k parameters.keys(): parameters[k]= v.default new_paramers_dict = ((parameters)) new_paramers_dict local_cache.keys(): local_cache[new_paramers_dict] = (fn(*agrs**kwargs)datetime.datetime.now().timestamp()) local_cache[new_paramers_dict] wrapper time (x=y=):time.sleep() x+y (add()) () (add())
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。