Method GetCounter
GetCounter(String, ReadThruOptions)
Returns instance of the counter specified with backing source ReadThruOptions.
Declaration
ICounter GetCounter(string key, ReadThruOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Name of counter. |
ReadThruOptions | options | ReadThruOptions to read from data source. These can be either ReadThru, ReadThruForced or none |
Returns
Type | Description |
---|---|
ICounter | Interface for using counters. |
Examples
The following example demonstrates how to get a distributed counter handler from ICache.
ICache cache = CacheManager.GetCache("demoClusteredCache");
string dataTypeName = "DistributedCounter";
ICounter counter = cache.DataTypeManager.GetCounter(dataTypeName);