def _get_cache(): global MC if MC is None: MC = memorycache.get_client() return MC
def __init__(self, *args, **kwargs): test = kwargs.get('test') if not CONF.memcached_servers and not test: raise RuntimeError(_('memcached_servers not defined')) self.mc = memorycache.get_client() self.db_allowed = kwargs.get('db_allowed', True) self.conductor_api = conductor.API(use_local=self.db_allowed)
def __init__(self, scheduler_driver=None, *args, **kwargs): super(ConsoleAuthManager, self).__init__(service_name='consoleauth', *args, **kwargs) self.mc = memorycache.get_client() self.compute_rpcapi = compute_rpcapi.ComputeAPI() self.cells_rpcapi = cells_rpcapi.CellsAPI()
def memoizer(context, reqid): global _CACHE if not _CACHE: _CACHE = memorycache.get_client() key = "%s:%s" % (func.__name__, reqid) value = _CACHE.get(key) if value is None: value = func(context, reqid) _CACHE.set(key, value, time=_CACHE_TIME) return value
def __init__(self, application): """middleware can use fake for testing.""" self.mc = memorycache.get_client() super(Lockout, self).__init__(application)
def __init__(self): self._cache = memorycache.get_client() self.conductor_api = conductor.API()
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """Availability zone helper functions.""" from oslo.config import cfg from nova import db from nova.openstack.common import memorycache # NOTE(vish): azs don't change that often, so cache them for an hour to # avoid hitting the db multiple times on every request. AZ_CACHE_SECONDS = 60 * 60 MC = memorycache.get_client() availability_zone_opts = [ cfg.StrOpt('internal_service_availability_zone', default='internal', help='availability_zone to show internal services under'), cfg.StrOpt('default_availability_zone', default='nova', help='default compute node availability_zone'), ] CONF = cfg.CONF CONF.register_opts(availability_zone_opts) def set_availability_zones(context, services):
def __init__(self): self.mc = memorycache.get_client()
def __init__(self, *args, **kwargs): if not CONF.memcached_servers: raise RuntimeError(_('memcached_servers not defined')) self.mc = memorycache.get_client()
def __init__(self, scheduler_driver=None, *args, **kwargs): super(ConsoleAuthManager, self).__init__(*args, **kwargs) self.mc = memorycache.get_client() self.compute_rpcapi = compute_rpcapi.ComputeAPI() self.conductor_api = conductor_api.API()
def __init__(self): self._cache = memorycache.get_client()