Returns configuration information common to both Couchbase and Memcached buckets
@return The configuration object to be injected
519317
protected Map<String,Object> getCommonConfig() {
        Map<String,Object> mm = new HashMap<String, Object>();
        mm.put("replicaNumber", numReplicas);
        Map<String,Object> ramQuota = new HashMap<String, Object>();
        ramQuota.put("rawRAM", 1024 * 1024 * 100);
        ramQuota.put("ram", 1024 * 1024 * 100);
        mm.put("quota", ramQuota);
        return mm;
    }
1035045
public static <Key, Entry> CacheConfiguration<Key, Entry> getCacheConfiguration(String cacheName) {
        CacheConfiguration<Key, Entry> cacheCfg = new CacheConfiguration<>(cacheName);
        cacheCfg.setBackups(0);
        cacheCfg.setCacheMode(CacheMode.PARTITIONED);
        cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
        cacheCfg.setReadThrough(false);
        cacheCfg.setWriteThrough(false);
        cacheCfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
        cacheCfg.setEvictionPolicy(new LruEvictionPolicy<>(10000));
        cacheCfg.setSwapEnabled(true);
        cacheCfg.setOffHeapMaxMemory(5L * 1024L * 1024L * 1024L);
        return cacheCfg;
    }
461268
public ConfigurationRequest getEnrichedRequestedConfiguration() {
        final Map<String, String> regularUsers = userService.loadAll().stream()
                .collect(Collectors.toMap(User::getName, User::getName));

        final Map<String, String> userNames = ImmutableMap.<String, String>builder()
                .put(graylogConfig.getRootUsername(), graylogConfig.getRootUsername())
                .putAll(regularUsers)
                .build();

        return getConfigurationRequest(userNames);
    }
43396
public synchronized Configuration loadConfiguration() {
    if (configurationBuffer.position(0).readByte() == 1) {
      int bytesLength = configurationBuffer.readInt();
      if (bytesLength == 0) {
        return null;
      }
      return serializer.decode(configurationBuffer.readBytes(bytesLength));
    }
    return null;
  }
44313
@Override
    public CacheEvictionConfig getEvictionConfig() {
        final CacheEvictionConfig evictionConfig = super.getEvictionConfig();
        if (evictionConfig == null) {
            return null;
        }
        return evictionConfig.getAsReadOnly();
    }
535048
private static Map<String, String> loadDatabaseConfig(
			final Configuration config) {
		// create database configuration
		final Map<String, String> databaseConfig = new HashMap<String, String>();

		// fill database configuration
		databaseConfig.put("cache_type", config.getCacheType());
		databaseConfig.put("use_memory_mapped_buffers",
				config.getUseMemoryMappedBuffers());

		return databaseConfig;
	}
185823
public ObjectPool<MemcachedClientIF> getObjectPool() {
        val pool = new GenericObjectPool<MemcachedClientIF>(this);
        pool.setMaxIdle(memcachedProperties.getMaxIdle());
        pool.setMinIdle(memcachedProperties.getMinIdle());
        pool.setMaxTotal(memcachedProperties.getMaxTotal());
        return pool;
    }
1318345
private ClusterConfigInfoEx getClusterConfiguration(ConnectionResources connectionResources, ManagedObjectReference clusterMor,
                                                        String clusterName) throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {
        ObjectContent[] objectContents = GetObjectProperties.getObjectProperties(connectionResources, clusterMor, new String[]{ClusterParameter.CONFIGURATION_EX.getValue()});
        if (objectContents != null && objectContents.length == 1) {
            List<DynamicProperty> dynamicProperties = objectContents[0].getPropSet();
            if (dynamicProperties != null && dynamicProperties.size() == 1 && dynamicProperties.get(0).getVal() instanceof ClusterConfigInfoEx) {
                return (ClusterConfigInfoEx) dynamicProperties.get(0).getVal();
            }
        }
        throw new RuntimeException(String.format(ANOTHER_FAILURE_MSG, clusterName));
    }
1171540
public void getConfigurationInto(Entries configuration) {
    for (String prefix : prefixes) {
      configuration.setBoolean(prefix + ENABLE_SERVICE_ACCOUNTS_SUFFIX, isServiceAccountEnabled());
      if (getServiceAccountEmail() != null) {
        configuration.set(prefix + SERVICE_ACCOUNT_EMAIL_SUFFIX, getServiceAccountEmail());
      }
      if (getServiceAccountPrivateKeyId() != null) {
        configuration.set(
            prefix + SERVICE_ACCOUNT_PRIVATE_KEY_ID_SUFFIX, getServiceAccountPrivateKeyId());
      }
      if (getServiceAccountPrivateKey() != null) {
        configuration.set(
            prefix + SERVICE_ACCOUNT_PRIVATE_KEY_SUFFIX, getServiceAccountPrivateKey());
      }
      if (getServiceAccountKeyFile() != null) {
        configuration.set(prefix + SERVICE_ACCOUNT_KEYFILE_SUFFIX, getServiceAccountKeyFile());
      }
      if (getServiceAccountJsonKeyFile() != null) {
        configuration.set(prefix + JSON_KEYFILE_SUFFIX, getServiceAccountJsonKeyFile());
      }
      if (getClientId() != null) {
        configuration.set(prefix + CLIENT_ID_SUFFIX, getClientId());
      }
      if (getClientSecret() != null) {
        configuration.set(prefix + CLIENT_SECRET_SUFFIX, getClientSecret());
      }
      if (getOAuthCredentialFile() != null) {
        configuration.set(prefix + OAUTH_CLIENT_FILE_SUFFIX, getOAuthCredentialFile());
      }
      configuration.setBoolean(prefix + ENABLE_NULL_CREDENTIAL_SUFFIX, isNullCredentialEnabled());
    }

    // Transport configuration does not use prefixes
    if (getProxyAddress() != null) {
      configuration.set(PROXY_ADDRESS_KEY, getProxyAddress());
    }
    if (getProxyUsername() != null) {
      configuration.set(PROXY_USERNAME_KEY, getProxyUsername());
    }
    if (getProxyPassword() != null) {
      configuration.set(PROXY_PASSWORD_KEY, getProxyPassword());
    }
    configuration.set(HTTP_TRANSPORT_KEY, getTransportType().name());
  }
729313
private Configuration getConfigurationInternal(final String[] keys) {

		Configuration conf = new Configuration();

		synchronized (this.confData) {

			final Iterator<String> it = this.confData.keySet().iterator();

			while (it.hasNext()) {

				final String key = it.next();
				boolean found = false;
				if (keys != null) {
					for (int i = 0; i < keys.length; i++) {
						if (key.equals(keys[i])) {
							found = true;
							break;
						}
					}

					if (found) {
						conf.setString(key, this.confData.get(key));
					}
				} else {
					conf.setString(key, this.confData.get(key));
				}
			}
		}

		return conf;
	}
225955
protected function getExtensionConfiguration()
    {
        $cacheInstance = CacheService::get()->getCacheInstance();
        $hash = $this->getContextHash();

        if ($cacheInstance->has($hash)) {
            $result = $cacheInstance->get($hash);
        } else {
            $result = $this->getFullConfiguration();
            $result = (ArrayUtility::isValidPath($result, self::EXTENSION_CONFIGURATION_PATH, '.'))
                ? ArrayUtility::getValueByPath($result, self::EXTENSION_CONFIGURATION_PATH, '.')
                : [];

            if (ArrayUtility::isValidPath($result, 'settings.typoScriptIncluded', '.')) {
                $cacheInstance->set($hash, $result);
            }
        }

        return $result;
    }
1012751
private static void locateForMemcacheBucket(final BinaryRequest request, final List<Node> nodes,
        final MemcachedBucketConfig config, CoreEnvironment env, RingBuffer<ResponseEvent> responseBuffer) {

        if (!keyIsValid(request)) {
            return;
        }

        NetworkAddress hostname = config.nodeForId(request.keyBytes());
        request.partition((short) 0);

        for (Node node : nodes) {
            if (node.hostname().equals(hostname)) {
                node.send(request);
                return;
            }
        }

        if(handleNotEqualNodeSizes(config.nodes().size(), nodes.size())) {
            RetryHelper.retryOrCancel(env, request, responseBuffer);
            return;
        }

        throw new IllegalStateException("Node not found for request" + request);
    }
1249822
def autoconf(self):
        
        serverInfo = MemcachedInfo(self._host,  self._port, self._socket_file)
        return (serverInfo is not None)
109182
public static synchronized CouchbaseEnvironment getInstance(Config config)
  {
    Boolean sslEnabled = ConfigUtils.getBoolean(config, CouchbaseWriterConfigurationKeys.SSL_ENABLED, false);
    String sslKeystoreFile = ConfigUtils.getString(config, CouchbaseWriterConfigurationKeys.SSL_KEYSTORE_FILE, "");
    String sslKeystorePassword = ConfigUtils.getString(config, CouchbaseWriterConfigurationKeys.SSL_KEYSTORE_PASSWORD, "");
    String sslTruststoreFile = ConfigUtils.getString(config, CouchbaseWriterConfigurationKeys.SSL_TRUSTSTORE_FILE, "");
    String sslTruststorePassword = ConfigUtils.getString(config, CouchbaseWriterConfigurationKeys.SSL_TRUSTSTORE_PASSWORD, "");
    Boolean certAuthEnabled = ConfigUtils.getBoolean(config, CouchbaseWriterConfigurationKeys.CERT_AUTH_ENABLED, false);

    DefaultCouchbaseEnvironment.Builder builder = DefaultCouchbaseEnvironment
	.builder()
        .sslEnabled(sslEnabled)
        .sslKeystoreFile(sslKeystoreFile)
        .sslKeystorePassword(sslKeystorePassword)
        .sslTruststoreFile(sslTruststoreFile)
        .sslTruststorePassword(sslTruststorePassword)
        .certAuthEnabled(certAuthEnabled);

    if (couchbaseEnvironment == null)
    {
      return builder.build();
    }
    else {
      return couchbaseEnvironment;
    }
  }
687165
@Override
  public Config getOwnConfig(final ConfigKeyPath configKey) {
    try {
      return this.ownConfigCache.get(configKey, new Callable<Config>() {
        @Override
        public Config call()  {
          return InMemoryValueInspector.this.valueFallback.getOwnConfig(configKey);
        }
      });
    } catch (ExecutionException e) {
      // should NOT come here
      throw new RuntimeException("Can not getOwnConfig for " + configKey);
    }
  }
13132
def get_config(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    if not conn:
        return None
    try:
        cc = conn.describe_cache_clusters(name,
                                          show_cache_node_info=True)
    except boto.exception.BotoServerError as e:
        msg = 'Failed to get config for cache cluster {0}.'.format(name)
        log.error(msg)
        log.debug(e)
        return {}
    cc = cc['DescribeCacheClustersResponse']['DescribeCacheClustersResult']
    cc = cc['CacheClusters'][0]
    ret = odict.OrderedDict()
    attrs = ['engine', 'cache_parameter_group', 'cache_cluster_id',
             'cache_security_groups', 'replication_group_id',
             'auto_minor_version_upgrade', 'num_cache_nodes',
             'preferred_availability_zone', 'security_groups',
             'cache_subnet_group_name', 'engine_version', 'cache_node_type',
             'notification_configuration', 'preferred_maintenance_window',
             'configuration_endpoint', 'cache_cluster_status', 'cache_nodes']
    for key, val in six.iteritems(cc):
        _key = boto.utils.pythonize_name(key)
        if _key not in attrs:
            continue
        if _key == 'cache_parameter_group':
            if val:
                ret[_key] = val['CacheParameterGroupName']
            else:
                ret[_key] = None
        elif _key == 'cache_nodes':
            if val:
                ret[_key] = [k for k in val]
            else:
                ret[_key] = []
        elif _key == 'cache_security_groups':
            if val:
                ret[_key] = [k['CacheSecurityGroupName'] for k in val]
            else:
                ret[_key] = []
        elif _key == 'configuration_endpoint':
            if val:
                ret['port'] = val['Port']
                ret['address'] = val['Address']
            else:
                ret['port'] = None
                ret['address'] = None
        elif _key == 'notification_configuration':
            if val:
                ret['notification_topic_arn'] = val['TopicArn']
            else:
                ret['notification_topic_arn'] = None
        else:
            ret[_key] = val
    return ret
629924
@Override
  public Configuration getMainConfiguration() {

    return Tang.Factory.getTang().newConfigurationBuilder()
            .bindImplementation(RuntimeClasspathProvider.class, YarnClasspathProvider.class)
            .bindConstructor(org.apache.hadoop.yarn.conf.YarnConfiguration.class, YarnConfigurationConstructor.class)
            .build();
  }