Merge "Allow bmemcached to be optional for memcache_pool"

This commit is contained in:
Zuul 2023-02-27 13:25:26 +00:00 committed by Gerrit Code Review
commit e8da407874
2 changed files with 16 additions and 1 deletions

View File

@ -19,7 +19,13 @@ import functools
from dogpile.cache.backends import memcached as memcached_backend
from oslo_cache import _bmemcache_pool
try:
from oslo_cache import _bmemcache_pool
except ImportError as e:
if str(e) == "No module named 'bmemcached'":
_bmemcache_pool = None
else:
raise
from oslo_cache import _memcache_pool
@ -57,6 +63,8 @@ class PooledMemcachedBackend(memcached_backend.MemcachedBackend):
def __init__(self, arguments):
super(PooledMemcachedBackend, self).__init__(arguments)
if arguments.get('sasl_enabled', False):
if not _bmemcache_pool:
raise ImportError("python-binary-memcached package is missing")
self.client_pool = _bmemcache_pool.BMemcacheClientPool(
self.url,
arguments,

View File

@ -0,0 +1,7 @@
---
fixes:
- |
[`bug 1991250 <https://bugs.launchpad.net/oslo.cache/+bug/1991250>`_]
The python-binary-memcached package is only required if sasl_enabled=True.
When sasl_enabled=False (default), the memcache_pool backend can be used
without the python-binary-memcached package installed.