Defines the configuration of the ___protobuf_metadata internal cache.
340451
@Inject
   protected void init(EmbeddedCacheManager cacheManager, InternalCacheRegistry internalCacheRegistry) {
      this.cacheManager = cacheManager;
      internalCacheRegistry.registerInternalCache(PROTOBUF_METADATA_CACHE_NAME,
            getProtobufMetadataCacheConfig().build(),
            EnumSet.of(Flag.USER, Flag.PROTECTED, Flag.PERSISTENT));
   }
600859
def _init_metadata(self):
        """"""

        # pylint: disable=attribute-defined-outside-init
        # this method is called from descendent __init__
        self._mdata.update(default_mdata.get_osid_form_mdata())
        update_display_text_defaults(self._mdata['journal_comment'], self._locale_map)
        for element_name in self._mdata:
            self._mdata[element_name].update(
                {'element_id': Id(self._authority,
                                  self._namespace,
                                  element_name)})
        self._journal_comment_default = self._mdata['journal_comment']['default_string_values'][0]
        self._validation_messages = {}
785850
public void initialize(Map<String, String> params) throws WPBIOException
	{
		try
		{
			memcacheClient = new WPBMemCacheClient();
			String address = "";
			if (params!= null && params.get(CONFIG_MEMCACHE_SERVERS) != null)
			{
				address = params.get(CONFIG_MEMCACHE_SERVERS);
			}
			memcacheClient.initialize(address);
			
			if (params.get(CONFIG_MEMCACHE_CHECK_INTERVAL) != null)
			{
				try
				{
					sleepTime = Integer.valueOf(params.get(CONFIG_MEMCACHE_CHECK_INTERVAL));
				} catch (NumberFormatException e)
				{
					// do nothing, rely on default value
				}
			}
			WPBMemCacheSyncRunnable syncRunnable = new WPBMemCacheSyncRunnable(this, memcacheClient, sleepTime);
			(new Thread(syncRunnable)).start();
			
		} catch (IOException e)
		{
			throw new WPBIOException("cannot create memcache client", e);
		}
	}
849094
private synchronized void initSystemCache() {
        List<StoreDefinition> value = storeMapper.readStoreList(new StringReader(SystemStoreConstants.SYSTEM_STORE_SCHEMA));
        metadataCache.put(SYSTEM_STORES_KEY, new Versioned<Object>(value));
    }
162793
def internal_set(symbol, value)
      if configurables.key?(symbol)
        configurables[symbol].set(configuration, value)
      elsif config_contexts.key?(symbol)
        config_contexts[symbol].restore(value.to_hash)
      else
        if config_strict_mode == :warn
          Chef::Log.warn("Setting unsupported config value #{symbol}.")
        elsif config_strict_mode
          raise UnknownConfigOptionError, "Cannot set unsupported config value #{symbol}."
        end
        configuration[symbol] = value
      end
    end
342211
def __init_configrs(self, rs_cfg):
        """"""
        # Use 'rs_id' to set the id for consistency, but need to rename
        # to 'id' to use with ReplicaSets.create()
        rs_cfg['id'] = rs_cfg.pop('rs_id', None)
        for member in rs_cfg.setdefault('members', [{}]):
            member['procParams'] = self._strip_auth(
                member.get('procParams', {}))
            member['procParams']['configsvr'] = True
            if self.enable_ipv6:
                common.enable_ipv6_single(member['procParams'])
        rs_cfg['sslParams'] = self.sslParams
        self._configsvrs.append(ReplicaSets().create(rs_cfg))
1277301
def _create_meta_cache(self):
        
        try:
            with open(self._cache_filename, 'wb') as f:
                compat.pickle.dump(self._document_meta, f, 1)
        except (IOError, compat.pickle.PickleError):
            pass
388717
private static void configureCaches(
      ImagePipelineConfig.Builder configBuilder,
      Context context) {
    final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
        ConfigConstants.MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
        Integer.MAX_VALUE,                     // Max entries in the cache
        ConfigConstants.MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
        Integer.MAX_VALUE,                     // Max length of eviction queue
        Integer.MAX_VALUE,                     // Max cache entry size
        TimeUnit.MINUTES.toMillis(5));         // Interval for checking cache parameters
    configBuilder
        .setBitmapMemoryCacheParamsSupplier(
            new Supplier<MemoryCacheParams>() {
              public MemoryCacheParams get() {
                return bitmapCacheParams;
              }
            })
        .setMainDiskCacheConfig(
            DiskCacheConfig.newBuilder(context)
                .setBaseDirectoryPath(context.getApplicationContext().getCacheDir())
                .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
                .setMaxCacheSize(ConfigConstants.MAX_DISK_CACHE_SIZE)
                .build());
  }
129077
def _set_blob_metadata(self, ud, metadata):
        # type: (Uploader, blobxfer.models.upload.Descriptor, dict) -> None
        
        blobxfer.operations.azure.blob.set_blob_metadata(ud.entity, metadata)
        if blobxfer.util.is_not_empty(ud.entity.replica_targets):
            for ase in ud.entity.replica_targets:
                blobxfer.operations.azure.blob.set_blob_metadata(ase, metadata)
701331
protected function setup_metadata() {
		if ( ! $this->meta_type ) {
			return;
		}

		$metadata = $this->get_metadata();
		foreach ( $this->get_mapping() as $attribute => $meta ) {
			if ( isset( $metadata[ $meta ] ) ) {
				$this->set_attribute( $attribute, $metadata[ $meta ] );
			}
		}
	}
581508
def _init_metadata(self):
        """"""
        self._enclosed_object_metadata = {
            'element_id': Id(self.my_osid_object_form._authority,
                             self.my_osid_object_form._namespace,
                             'enclosed_object'),
            'element_label': 'Enclosed Object',
            'instructions': 'accepts an osid object Id',
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_id_values': [''],
            'syntax': 'ID',
            'id_set': []
        }
554576
public function ensureProductionSettings() : void
    {
        $queryCacheImpl = $this->getQueryCacheImpl();

        if (! $queryCacheImpl) {
            throw QueryCacheNotConfigured::create();
        }

        if ($queryCacheImpl instanceof ArrayCache) {
            throw QueryCacheUsesNonPersistentCache::fromDriver($queryCacheImpl);
        }

        $metadataCacheImpl = $this->getMetadataCacheImpl();

        if (! $metadataCacheImpl) {
            throw MetadataCacheNotConfigured::create();
        }

        if ($metadataCacheImpl instanceof ArrayCache) {
            throw MetadataCacheUsesNonPersistentCache::fromDriver($metadataCacheImpl);
        }

        if ($this->getProxyManagerConfiguration()->getGeneratorStrategy() instanceof EvaluatingGeneratorStrategy) {
            throw ProxyClassesAlwaysRegenerating::create();
        }
    }
831566
def set_metadata(self, metadata: MetaData) -> None:
        
        self._parent.set_metadata(metadata)
        self._child.set_metadata(metadata)
1093567
protected function configureCache()
    {
        if (!isset($this['cache'])) {
            $this['cache'] = [
                'type' => 'array'
            ];
        }
        if (!isset($this['cache']['type'])) {
            throw new RuntimeException("cache type not configured correctly");
        }
        switch ($this['cache']['type']) {
            case 'array':
                $cache = new \Symfony\Component\Cache\Adapter\ArrayAdapter();
                break;
            case 'filesystem':
                $directory = $this['cache']['directory'];
                if (!$directory) {
                    throw new RuntimeException("cache directory not configured (please check doc/cache.md)");
                }
                if (!file_exists($directory)) {
                    mkdir($directory, 0777, true);
                }
                $cache = new \Symfony\Component\Cache\Adapter\FilesystemAdapter('', 0, $directory);
                break;
            default:
                throw new RuntimeException("Unsupported cache.type:" . $this['cache']['type']);

        }
        $this['cache'] = $cache;
    }
204352
def set_metadata(self, key, metadata):
        
        with self._lock:
            self._metadata[key] = metadata
1073911
@PostConstruct
	@SuppressWarnings("unchecked")
	protected void configure() {

		// scan all fields
		for (Field field : getClass().getDeclaredFields()) {

			// if it's a preprocessor, register it
			if (IModifier.class.isAssignableFrom(field.getType())) {

				try {
					field.setAccessible(true);
					final IModifier processor = (IModifier) field.get(this);
					processorsCache.put(processor.getAnnotationType(), processor);
				} catch (IllegalArgumentException | IllegalAccessException ex) {
					LoggerFactory.getLogger(ModifiersPreprocessor.class) .error("Could not register pre-processor for field " + field.getName());
				}
			}
		}
	}
56641
def _cache_metrics_metadata(self, instance):
        
        # ## <TEST-INSTRUMENTATION>
        t = Timer()
        # ## </TEST-INSTRUMENTATION>

        i_key = self._instance_key(instance)
        self.metadata_cache.init_instance(i_key)
        self.log.info("Warming metrics metadata cache for instance {}".format(i_key))
        server_instance = self._get_server_instance(instance)
        perfManager = server_instance.content.perfManager
        custom_tags = instance.get('tags', [])

        new_metadata = {}
        metric_ids = []
        # Use old behaviour with metrics to collect defined by our constants
        if self.in_compatibility_mode(instance, log_warning=True):
            for counter in perfManager.perfCounter:
                metric_name = self.format_metric_name(counter, compatibility=True)
                new_metadata[counter.key] = {'name': metric_name, 'unit': counter.unitInfo.key}
                # Build the list of metrics we will want to collect
                if instance.get("all_metrics") or metric_name in BASIC_METRICS:
                    metric_ids.append(vim.PerformanceManager.MetricId(counterId=counter.key, instance="*"))
        else:
            collection_level = instance.get("collection_level", 1)
            for counter in perfManager.QueryPerfCounterByLevel(collection_level):
                new_metadata[counter.key] = {"name": self.format_metric_name(counter), "unit": counter.unitInfo.key}
                # Build the list of metrics we will want to collect
                metric_ids.append(vim.PerformanceManager.MetricId(counterId=counter.key, instance="*"))

        self.log.info("Finished metadata collection for instance {}".format(i_key))
        # Reset metadata
        self.metadata_cache.set_metadata(i_key, new_metadata)
        self.metadata_cache.set_metric_ids(i_key, metric_ids)

        self.cache_config.set_last(CacheConfig.Metadata, i_key, time.time())

        # ## <TEST-INSTRUMENTATION>
        self.histogram('datadog.agent.vsphere.metric_metadata_collection.time', t.total(), tags=custom_tags)