def retrieve_all_sections():
    sections = cache.get(SECTION_CACHE_KEY, None)
    if sections is None:
        sections = Section.objects.order_by('-priority')
        if CACHE_TIMEOUT:
            sections = list(sections)
            cache.set(SECTION_CACHE_KEY, sections, CACHE_TIMEOUT)
    return sections
Get all sections from the cache or query the database.
dataset/ETHPy150Open mlavin/django-ad-code/adcode/models.py/retrieve_all_sections