NCache 4.6 - Online Documentation

Sample Usage of MapReduce

 
In order to execute the MapReduce task after implementing the interfaces, please follow the steps below:
 
  •     Initialize MapReduce Task.
 
  MapReduceTask task = new MapReduceTask();
 
  •     Set Mapper, Combiner factory and Reducer factory. Add filters, if required.
 
  task.Mapper = new WordCountMapper();
  task.Combiner = new WordCountCombinerFactory();
  task.Reducer = new WordCountReducerFactory();
 
  •     Execute task on cache.
 
  ITrackableTask wordCount = cache.ExecuteTask(task);
 
  •     Optional: enumerate over the result generated using enumeration.
 
  ITaskResult result= wordCount.GetResult(); 
 
  IDictionaryEnumerator enumResult = result.GetEnumerator();
 
  while (enumResult.MoveNext())
  {
    //perform operations       
  }
 
 
See Also