Repository: incubator-ignite Updated Branches: refs/heads/ignite-964 830f397d0 -> 5a8982fee
#ignite-964: aff removeAllFromCache method for nodejs cache. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5a8982fe Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5a8982fe Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5a8982fe Branch: refs/heads/ignite-964 Commit: 5a8982fee9dce01e5495a1e257735c292ceeec96 Parents: 830f397 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Wed Jul 1 16:16:40 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Wed Jul 1 16:16:40 2015 +0300 ---------------------------------------------------------------------- modules/nodejs/src/main/js/cache.js | 11 +++++++++++ .../apache/ignite/internal/NodeJsCacheApiSelfTest.java | 7 +++++++ modules/nodejs/src/test/js/test-cache-api.js | 8 ++++++++ 3 files changed, 26 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a8982fe/modules/nodejs/src/main/js/cache.js ---------------------------------------------------------------------- diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js index 57f1f79..c96b709 100644 --- a/modules/nodejs/src/main/js/cache.js +++ b/modules/nodejs/src/main/js/cache.js @@ -128,6 +128,17 @@ Cache.prototype.removeAll = function(keys, callback) { } /** + * Remove all cache keys + * + * @this {Cache} + * @param {noValue} callback Called on finish + */ +Cache.prototype.removeAllFromCache = function(callback) { + this._server.runCommand(this._createCommand("rmvall"), + callback); +} + +/** * Put keys to cache * * @this {Cache} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a8982fe/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java index 596c964..47e4f09 100644 --- a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java +++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java @@ -168,4 +168,11 @@ public class NodeJsCacheApiSelfTest extends NodeJsAbstractTest { public void testRemoveValue() throws Exception { runJsScript("testRemoveValue"); } + + /** + * @throws Exception If failed. + */ + public void testRemoveAllFromCache() throws Exception { + runJsScript("testRemoveAllFromCache"); + } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5a8982fe/modules/nodejs/src/test/js/test-cache-api.js ---------------------------------------------------------------------- diff --git a/modules/nodejs/src/test/js/test-cache-api.js b/modules/nodejs/src/test/js/test-cache-api.js index 77b1684..4766c9c 100644 --- a/modules/nodejs/src/test/js/test-cache-api.js +++ b/modules/nodejs/src/test/js/test-cache-api.js @@ -152,6 +152,14 @@ testGetAndRemove = function() { startTest("mycache", {trace: [put, getAndRemove, getNone], entry: ["key", "6"]}); } +testRemoveAllFromCache = function() { + function removeAllFromCache(cache, entry, next) { + cache.removeAllFromCache(next); + } + + startTest("mycache", {trace: [put, removeAllFromCache, getNone], entry: ["key", "6"]}); +} + function objectEntries() { entries = [];