85
Use cases
Facebook isn’t just caching the home page. It’s also caching the About
page,
the Contact page, the Terms and Conditions page, and a lot more.
So it needs a mapping from page URL to page data.
When you visit a page on Facebook, it first
checks whether the page is
stored in the hash.
Here it is in code:
cache = {}
def get_page(url):
if cache.get(url):
return cache[url]
Dostları ilə paylaş: