20. - -copyright Fringe81 Co.,Ltd.
client.put(
new WritePolicy(),
new Key(“namespace”, “setname”, “key1”),
new Bin(“num”, 1),
new Bin(“bool”, true));
Bin部は可変長引数
21. - -copyright Fringe81 Co.,Ltd.
getBooleanとgetObjectで挙動が異なる
Record record =
client.get(
new Policy(),
new Key(“namespace”, “setname”,“key1”),
“num”);
int n = record.getInt(“num”); // 1
boolean b = record.getBoolean(“bool”); // false
Object o = record.getValue(“bool”); // null
22. - -copyright Fringe81 Co.,Ltd.
Serializableを実装している
任意のクラスも保存可能
Record#getList
Record#getMap
はない
Record#getObject
を使用してダウンキャスト
boolean
int
long
float
double
String
List
Map
Object
byte[]
32. - -copyright Fringe81 Co.,Ltd.
サーバーに配置されたluaプログラムを実行
するためのメソッド。
LDT処理はサーバーのluaで実行される。
インストール時に/opt/aerospike/sys/udf/luaにluaスクリプトが配
置される。
function llist.add (topRec, ldtBinName, newValue, createSpec, src)
local meth = "llist.add()";
local rc = aerospike:set_context( topRec, UDF_CONTEXT_LDT );
if (rc ~= 0) then
error(ldte.ERR_NS_LDT_NOT_ENABLED);
end
if newValue == nil then
...略...
end
/opt/aerospike/sys/udf/lua/ldt/lib_llist.lua
AerospikeClient#execute
37. - -copyright Fringe81 Co.,Ltd.
local llist_lib = require(‘ldt/lib_llist’);
function addr(rec, binName, numVal)
local l = list()
elems = llist_lib.scan(rec, binName, nil, nil, nil, nil)
for e in list.iterator(elems) do
list.append(l, e + numVal)
end
llist_lib.destroy(rec, binName)
llist_lib.add_all(rec, binName, l);
return numVal
end
aql> register module ‘myfunc.lua’