大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
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())