No way to specify replace_existing_backend from Region.configure_from_config()

Issue #112 resolved
Anonymous created an issue

While writing some tests for our initialization logic of dogpile, I didn't find a way to trigger configure_from_config() in unittests while specifying replace_existing_backend.

My workaround was to del region.backend but that looks quite brittle, so I'd like to replace this with a way to specify that option.

Comments (4)

  1. Michael Bayer repo owner

    how about this?

    from dogpile.cache import make_region
    local_region = make_region()
    myconfig = {
        "cache.local.backend": "dogpile.cache.memory"
    local_region.configure_from_config(myconfig, "cache.local.")
    myconfig = {
        "cache.local.backend": "dogpile.cache.pylibmc",
        "cache.local.arguments.url": ",",
    myconfig["cache.local.replace_existing_backend"] = "true"
    local_region.configure_from_config(myconfig, "cache.local.")
  2. Log in to comment