Merge "Don't register backends on import"

This commit is contained in:
Jenkins 2015-07-13 16:44:31 +00:00 committed by Gerrit Code Review
commit 46f32c0422
2 changed files with 17 additions and 15 deletions

View File

@ -14,18 +14,10 @@
"""Caching Layer Implementation.
When this library is imported, it registers the following backends in
:mod:`dogpile.cache`:
* ``oslo_cache.noop`` - :class:`oslo_cache.backends.noop.NoopCacheBackend`
* ``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`
To use this library:
You must call :func:`configure`.
Inside your application code, decorate the methods that you want the results
to be cached with a memoization decorator created with
:func:`get_memoization_decorator`. This function takes a group name from the
@ -66,9 +58,6 @@ _BACKENDS = [
('oslo_cache.dict', 'oslo_cache.backends.dictionary', 'DictCacheBackend'),
]
for backend in _BACKENDS:
dogpile.cache.register_backend(*backend)
class _DebugProxy(proxy.ProxyBackend):
"""Extra Logging ProxyBackend."""
@ -367,8 +356,21 @@ def configure(conf):
This must be called before conf().
The following backends are registered in :mod:`dogpile.cache`:
* ``oslo_cache.noop`` - :class:`oslo_cache.backends.noop.NoopCacheBackend`
* ``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)

View File

@ -10,9 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_cache import _opts
from oslo_cache import core
from oslo_config import cfg
_opts.configure(cfg.CONF)
core.configure(cfg.CONF)