diff --git a/oslo_cache/backends/mongo.py b/oslo_cache/backends/mongo.py index 96e7808f..f66b8f05 100644 --- a/oslo_cache/backends/mongo.py +++ b/oslo_cache/backends/mongo.py @@ -16,7 +16,7 @@ import abc import datetime from dogpile.cache import api -from dogpile.cache import util as dp_util +from dogpile import util as dp_util from oslo_cache import core from oslo_log import log from oslo_utils import importutils diff --git a/oslo_cache/core.py b/oslo_cache/core.py index 54dd1b1c..83421efe 100644 --- a/oslo_cache/core.py +++ b/oslo_cache/core.py @@ -61,13 +61,6 @@ NO_VALUE = api.NO_VALUE _LOG = log.getLogger(__name__) -_BACKENDS = [ - ('oslo_cache.mongo', 'oslo_cache.backends.mongo', 'MongoCacheBackend'), - ('oslo_cache.memcache_pool', 'oslo_cache.backends.memcache_pool', - 'PooledMemcachedBackend'), - ('oslo_cache.dict', 'oslo_cache.backends.dictionary', 'DictCacheBackend'), -] - class _DebugProxy(proxy.ProxyBackend): """Extra Logging ProxyBackend.""" @@ -366,22 +359,13 @@ def get_memoization_decorator(conf, region, group, expiration_group=None): def configure(conf): """Configure the library. + Register the required oslo.cache config options into an oslo.config CONF + object. + This must be called before conf(). - The following backends are registered in :mod:`dogpile.cache`: - - * ``oslo_cache.mongo`` - - :class:`oslo_cache.backends.mongo.MongoCacheBackend` - * ``oslo_cache.memcache_pool`` - - :class:`oslo_cache.backends.memcache_pool.PooledMemcachedBackend` - * ``oslo_cache.dict`` - - :class:`oslo_cache.backends.dictionary.DictCacheBackend` - :param conf: The configuration object. :type conf: oslo_config.cfg.ConfigOpts """ _opts.configure(conf) - - for backend in _BACKENDS: - dogpile.cache.register_backend(*backend) diff --git a/setup.cfg b/setup.cfg index 9de611d1..938cbfdd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,6 +27,11 @@ packages = oslo.config.opts = oslo.cache = oslo_cache._opts:list_opts +dogpile.cache = + oslo_cache.mongo = oslo_cache.backends.mongo:MongoCacheBackend + oslo_cache.memcache_pool = oslo_cache.backends.memcache_pool:PooledMemcachedBackend + oslo_cache.dict = oslo_cache.backends.dictionary:DictCacheBackend + [extras] dogpile = python-memcached>=1.56 # PSF