Use entrypoints for backends
Register the oslo_cache backends via the dogpile.cache entry points rather than manually in configure. Change-Id: If62bbd8c613770926bd116ceaa05463630cbc0c0
This commit is contained in:
parent
f6108b0b66
commit
43f4c9781f
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user