Created
August 10, 2014 14:49
-
-
Save brunoborges/a7244d9439fcc505ba25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (arguments.length != 2) { | |
print("Usage: jjs -cp lib/kvclient.jar oracle-nosql-put.js -- <key> <value>"); | |
exit(1); | |
} | |
var oracle = Packages.oracle; | |
var KVStore = oracle.kv.KVStore; | |
var KVStoreConfig = oracle.kv.KVStoreConfig; | |
var KVStoreFactory = oracle.kv.KVStoreFactory; | |
var store = KVStoreFactory.getStore(new KVStoreConfig("kvstore", "localhost:5000")); | |
var nosqlPkg = new JavaImporter(oracle.kv); | |
with(nosqlPkg) { | |
var key = Key.createKey(arguments[0].toString()); | |
var value = Value.createValue(arguments[1].toString().getBytes("UTF-8")); | |
store.put(key, value); | |
store.close(); | |
print("key inserted/updated!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment