Apollo.Common.Configuration is a library for common configuration values. It will utilize an endpoint to load a config text, or a ConfigurationSet class from this endpoint. More information will be made available soon.

This library has it's own LogTool configured based on NLog. This is so that the common logging library can utilize this library for it's configuration.

  • Remove default option for item values, throw an exception on null
  • Check for app-* in app settings, throw exception on failed match
  • Require acc-application-name app setting be set
  • Revise environment lookup. (app setting, environment variable, http request uri, machine dns name, machine name)
  • Adjust to use a thread-safe Dictionary noted here for caching of values, since the updates are rare, this will remove the cache queue processing..

Will use a configname.ENVIRONMENT.appname.appversion.config pattern searching from narrow, to broad.

Sample Configuration File memcached.LOCAL.config
	<!-- memcached servers -- multiple values -->
	<item name="servers">
	<!-- minimum and maximum connection pool size -->
	<item name="MinPoolSize" value="16" />
	<item name="MaxPoolSize" value="128" />
	<!-- timeout for socket communications uint in milliseconds -- value in child node -->
	<item name="SendReceiveTimeout">3000</item>
	<!-- max time to keep a socket open, in minutes -- value in child cdata node -->
	<item name="SocketRecycleAge"><![CDATA[

Using the config values
using Apollo.Common.Configuration;
	//retreive configuration set
	ConfigurationSet settings = Config.Get("memcached");

	//read multiple Values (string[]) from configuration set
	string[] servers = settings["servers"].GetValues();
	MemcachedClient.Setup("Apollo.Common.Cache", servers);
	_mc = MemcachedClient.GetInstance("Apollo.Common.Cache");

	//set various uint values from memcached, uses generics to cast appropriately.
	_mc.MaxPoolSize = settings["MaxPoolSize"].GetValue();
	_mc.MinPoolSize = settings.GetItem("MinPoolSize").GetValue();
	_mc.CompressionThreshold = settings["CompressionThreshold"].GetValue();
	_mc.SendReceiveTimeout = settings["SendReceiveTimeout"].GetValue();
	double socketRecycleAge = settings["SocketRecycleAge"].GetValue(); //minutes
	_mc.SocketRecycleAge = TimeSpan.FromMinutes(socketRecycleAge);

Last edited Dec 18, 2008 at 8:59 PM by tracker1, version 5


No comments yet.