title: Ignite Cache Sum of values
body: <p>I am using Ignite tutorial code (link below), but I want to modify it such that it operates on a different type of data and the counts are done differently - rather than incrementing counter by 1 I want to add a current value.</p>
  
  <p>So let's assume I have number of occurences of a certain word in different documents, so let's assume I have something like this:</p>
  
  <p><em>'the' 6586</em></p>
  
  <p><em>'the' 925</em></p>
  
  <p>So I want Cache to hold 
  'the' 7511</p>
  
  <p>So given this: </p>
  
  <pre><code>try (Stream&lt;String&gt; lines = Files.lines(path)) {
              lines.forEach(line -&gt; {
                Stream&lt;String&gt; words = Stream.of(line.split(" "));
                List&lt;String&gt; tokens = words.collect(Collectors.toList());
                // this is just to emphasize that I want to pass value
                Long value = Long.parseLong(tokens.get(1));
                stmr.addData(tokens.get(0), Long.parseLong(tokens.get(1));
  </code></pre>
  
  <p>I would like the <em>value</em> to be passed to the stmr.receiver() method, so I can add it to the <em>val</em>.</p>
  
  <p>I have even tried creating a class variable in StreamWords that would store the value, but the value does not get updated, and in stmr.receiver() it is still 0 ( as initialized).</p>
  
  <p>Link to tutorial:
  <a href="http://apacheignite.gridgain.org/v1.1/docs/streaming-example/" rel="nofollow">Word Count Ignite Example</a></p>