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
|
import datetime
|
||||||
|
|
||||||
from dogpile.cache import api
|
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_cache import core
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
|
@ -61,13 +61,6 @@ NO_VALUE = api.NO_VALUE
|
|||||||
|
|
||||||
_LOG = log.getLogger(__name__)
|
_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):
|
class _DebugProxy(proxy.ProxyBackend):
|
||||||
"""Extra Logging ProxyBackend."""
|
"""Extra Logging ProxyBackend."""
|
||||||
@ -366,22 +359,13 @@ def get_memoization_decorator(conf, region, group, expiration_group=None):
|
|||||||
def configure(conf):
|
def configure(conf):
|
||||||
"""Configure the library.
|
"""Configure the library.
|
||||||
|
|
||||||
|
Register the required oslo.cache config options into an oslo.config CONF
|
||||||
|
object.
|
||||||
|
|
||||||
This must be called before conf().
|
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.
|
:param conf: The configuration object.
|
||||||
:type conf: oslo_config.cfg.ConfigOpts
|
:type conf: oslo_config.cfg.ConfigOpts
|
||||||
|
|
||||||
"""
|
"""
|
||||||
_opts.configure(conf)
|
_opts.configure(conf)
|
||||||
|
|
||||||
for backend in _BACKENDS:
|
|
||||||
dogpile.cache.register_backend(*backend)
|
|
||||||
|
@ -27,6 +27,11 @@ packages =
|
|||||||
oslo.config.opts =
|
oslo.config.opts =
|
||||||
oslo.cache = oslo_cache._opts:list_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]
|
[extras]
|
||||||
dogpile =
|
dogpile =
|
||||||
python-memcached>=1.56 # PSF
|
python-memcached>=1.56 # PSF
|
||||||
|
Loading…
Reference in New Issue
Block a user