def get_site_root_paths():
lang = get_language()
cache_key = ROOT_PATHS_CACHE_KEY_FMT.format(lang)
result = cache.get(cache_key)
if result is None:
result = [
(site.id, site.root_page.url_path, site.root_url)
for site in Site.objects.select_related('root_page').order_by('-root_page__url_path')
]
cache.set(cache_key, result, 3600)
return result
评论列表
文章目录