Sample Implementation of IValueExtractor Interface
To utilize the interface, include the following namespace in your application:
Alachisoft.NCache.Runtime.Aggregation
.
Even though NCache has provided its own Aggregator methods, users can still give their own implementation of the signature methods.
Implement the interface IValueExtractor
and provide the implementation for the
Extract()
method:
Member | Description |
---|---|
Extract(Object) |
This method takes in an Object and contains the logic to extract meaningful information/ attributes from the object like the Mapper does in MapReduce. The returned value may also be null. |
To utilize the
IValueExtractor
interface, include the following namespace in your application:Alachisoft.NCache.Runtime.Aggregation.
public class BasicTypeExtractor : IValueExtractor
{
public object Extract(object value)
{
try
{
if (value.GetType() == typeof(int))
{
return 0;
}
if (value.GetType() == typeof(float))
{
return 0.0;
}
}
catch (Exception e)
{
//handle exception
}
return value;
}
}