'This invalidates the cache for a given menu (site_id and language)'

def clear(self, site_id=None, language=None, all=False):

    if all:
        cache_keys = CacheKey.objects.get_keys()
    else:
        cache_keys = CacheKey.objects.get_keys(site_id, language)
    to_be_deleted = cache_keys.distinct().values_list('key', flat=True)
    if to_be_deleted:
        cache.delete_many(to_be_deleted)
        cache_keys.delete()
