def url_by_alias(page_alias):
"""
Try to read page url from cache. If it's missing then try to find
matching page that could be missing in cache. If page is found
then refresh all url list since it's too old.
If no matching is found then return None so we can throw any
exception we want in other places
"""
if page_alias:
url_to_alias = cache.get(cachekeys.URL_LIST_CACHE)
if url_to_alias is None:
url_to_alias = PageURLCache.refresh()
url = url_to_alias.get(page_alias)
else:
url = None
return url
# Models:
评论列表
文章目录