def get_flapage_from_cache(url):
    """
    Try get flatpage from cache entry with all flatpages by url.
    If not found, create cache and return flatpage from db.

    This probably avoid some hits on DB.
    """
    site_id = settings.SITE_ID
    cache_key = make_flatpages_cache_key()
    flatpages = cache.get(cache_key)
    if flatpages and url in flatpages:
        return flatpages[url]

    # flatpages cache not exist or flatpage not found.

    # 1. get all flatpages.
    flatpages = dict([(f.url, f) for f in
        FlatPage.objects.filter(sites__id__exact=site_id).order_by('url')])

    # 2. if url not in flatpages, raise Http404
    if flatpages not in url:
        raise Http404

    # 3. if url in flatpages, recreate cache and return flatpage
    cache.delete(cache_key)
    cache.add(cache_key, flatpages)
    return flatpages[url]
dataset/ETHPy150Open chronossc/django-breadcrumbs/breadcrumbs/utils.py/get_flapage_from_cache/swapped operands of `not in`