You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by iv...@apache.org on 2015/07/06 17:31:10 UTC

[1/2] incubator-ignite git commit: #ignite-964: add cache-put-get-example.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-964-1 fd4cb53eb -> c8af45dc9


#ignite-964: add cache-put-get-example.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ca754288
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ca754288
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ca754288

Branch: refs/heads/ignite-964-1
Commit: ca754288cbc97d7c193a3de7f1f47fabfc2c3ed8
Parents: fd4cb53
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Jul 6 13:29:53 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Jul 6 13:29:53 2015 +0300

----------------------------------------------------------------------
 .../nodejs/src/main/js/examples/src/cache-put-get-example.js | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca754288/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js b/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js
index e89570a..099721f 100644
--- a/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js
+++ b/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js
@@ -30,6 +30,11 @@ function onConnect(error, ignite) {
 
     var cache = ignite.getOrCreateCache("mycache");
 
+    putGet(cache);
+
+}
+
+putGet = function(cache) {
     console.log(">>> Cache put-get example started.");
 
     var keyCnt = 20;
@@ -68,5 +73,8 @@ function onConnect(error, ignite) {
     for (var i = 0; i < keyCnt; i++) {
         cache.put(i, i.toString(), onPut);
     }
+}
+
+putAllGetAll = function(cache) {
 
 }
\ No newline at end of file


[2/2] incubator-ignite git commit: #ignite-964: put-get-example.

Posted by iv...@apache.org.
#ignite-964: put-get-example.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c8af45dc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c8af45dc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c8af45dc

Branch: refs/heads/ignite-964-1
Commit: c8af45dc9cabe30de76918bc9ad8278704db3510
Parents: ca75428
Author: ivasilinets <iv...@gridgain.com>
Authored: Mon Jul 6 18:30:52 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Mon Jul 6 18:30:52 2015 +0300

----------------------------------------------------------------------
 .../js/examples/src/cache-put-get-example.js    | 41 ++++++++++++++++++++
 1 file changed, 41 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c8af45dc/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js b/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js
index 099721f..d6b65d8 100644
--- a/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js
+++ b/modules/nodejs/src/main/js/examples/src/cache-put-get-example.js
@@ -18,6 +18,7 @@
 var Ignite = require("../../");
 
 var Ignition = Ignite.Ignition;
+var Entry = Ignite.Entry;
 
 Ignition.start(['127.0.0.1:9095'], null, onConnect);
 
@@ -32,6 +33,8 @@ function onConnect(error, ignite) {
 
     putGet(cache);
 
+    putAllGetAll(cache);
+
 }
 
 putGet = function(cache) {
@@ -76,5 +79,43 @@ putGet = function(cache) {
 }
 
 putAllGetAll = function(cache) {
+    console.log(">>> Starting putAll-getAll example.");
+
+    var keyCnt = 20;
+
+    var batch = [];
+    var keys = [];
+
+    for (var i = keyCnt; i < keyCnt + keyCnt; ++i) {
+        var key = i;
+
+        var val = "bulk-" + i;
+
+        keys.push(key);
+        batch.push(new Entry(key, val));
+    }
+
+    var onGetAll = function(err, entries) {
+        if (err) {
+            console.log("Error: " + err);
+
+            throw new Error(err);
+        }
+
+        for (var e of entries) {
+            console.log("Got entry [key=" + e.key + ", val=" + e.value + ']');
+        }
+    }
+
+    var onPutAll= function(err) {
+        if (err) {
+            console.log("Error: " + err);
+
+            throw new Error(err);
+        }
+
+        cache.getAll(keys, onGetAll);
+    }
 
+    cache.putAll(batch, onPutAll);
 }
\ No newline at end of file