NCache 4.6 - Online Documentation

Sample Implementation of IValueExtractor Interface

 
Implement the interface IValueExtractor and provide the implementation for the Extract() method in NCache:
 
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;
        }
    }
 
 
See Also