"""网页缓存"""
cache = {} # 缓存
def get_page(url):
if cache.get(url): # 如果网页在缓存中
return cache[url]
else:
data = get_data_from_serve(url) # 从服务器获取网页
cache[url] = data # 先将数据保存到缓存中
return data
[Illustration] algorithm - Web Cache
Guess you like
Origin blog.csdn.net/weixin_44478378/article/details/104448334
Recommended
Ranking