'Start cache isolation by overriding the settings.CACHES and
flushing the cache.'

@classmethod
def start_cache_isolation(cls):

    cache_settings = None
    if ((cls.CACHES is not None) and (cls.ENABLED_CACHES is not None)):
        raise Exception('Use    either    CACHES    or    ENABLED_CACHES,    but    not    both')
    if (cls.CACHES is not None):
        cache_settings = cls.CACHES
    elif (cls.ENABLED_CACHES is not None):
        cache_settings = {'default': {'BACKEND': 'django.core.cache.backends.dummy.DummyCache'}}
        cache_settings.update({cache_name: {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': cache_name, 'KEY_FUNCTION': 'util.memcache.safe_key'} for cache_name in cls.ENABLED_CACHES})
    if (cache_settings is None):
        return
    cls.__old_settings.append(copy.deepcopy(settings.CACHES))
    override = override_settings(CACHES=cache_settings)
    override.__enter__()
    cls.__settings_overrides.append(override)
    assert (settings.CACHES == cache_settings)
    cls.clear_caches()
