-
Notifications
You must be signed in to change notification settings - Fork 17
ElastiCacheClusterConfig Configuration
Of the four ways to instantiate the config object, two utilize the app.config of the application and the other two use the values provided as parameters.
The two constructors that utilize the app.config are:
new ElastiCacheClusterConfig()
new ElastiCacheClusterConfig(string section)
The first constructor uses the app.config section clusterclient to find endpoint settings as well as any additional settings for the config as well as the Enyim MemcachedClient. The second constructor looks for the same information but in the section of the app.config specified in the parameter.
The required sub-section of the app.config section is the endpoint. All three setting sections that can be included in the app.config are listed below:
<configuration>
<configSections>
<section name="clusterclient" type="Amazon.ElastiCacheCluster.ClusterConfigSettings, Amazon.ElastiCacheCluster"/>
</configSections>
<clusterclient>
<endpoint hostname="YOU-ENDPOINT-URL-HERE" port="YOUR-PORT-HERE"/> <!-- REQUIRED -->
<node nodeTries="INTEGER" nodeDelay="INTEGER"/> <!-- OPTIONAL -->
<poller intervalDelay="INTEGER"/> <!-- OPTIONAL -->
</clusterclient>
</configuration>
The two constructors that initialize the config without using the app.config are:
new ElastiCacheClusterConfig(string hostname, int port)
new ElastiCacheClusterConfig(ClusterConfigSettings setup)
The first constructor takes the hostname of the endpoint and the port to connect to. This instantiation uses all the default values for the config and client making it quick and easy to use. If instantiation is done this way, code must be changed if the cluster in use ever changes where as the app.config can be changed more easily.
The second constructor takes a full ClusterConfigSettings object. This constructor allows the programmer to instantiate the config with many different custom settings without using the app.config. The best time to use this is if settings are changed based on an outside parameter where changing the app.config is unavailable or not an option.