8000 GitHub - x-soft-ua/xLuaAerospike: Calling Aerospike from Lua
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

x-soft-ua/xLuaAerospike

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Calling Aerospike from Lua ###Build Instructions

Run the build script located in the root directory of the repository to build the library "xLuaAerospikeLayer.so"

./build_linux.sh

The shared library “as_lua.so” has dependencies on the Aerospike C Client API. Refer to the Aerospike C Client documentation for instructions on insallation and dependencies.

IMPORTANT: The shared library as_lua.so should be placed in the Lua library path:

./xLuaAerospikeLayer.so
/usr/local/lib/lua/5.1/xLuaAerospikeLayer.so
/usr/lib/lua/5.1/xLuaAerospikeLayer.so

###Usage

Require library and init connection

local as_layer = require "lib.xLuaAerospike"
local as_connection = as_layer.as_conf_init("127.0.0.1", 3000, "test", "demo")
local asKey = "testkey"

Increment bin value

local count, status = as_layer.as_bin_incr(as_connection, asKey, "incr", 15)
if (status == as_layer.AS_LAYER_OK) then
    ngx.say("Incr count = "..count)
end

Set bin value

local status = as_layer.as_bin_set(as_connection, asKey, "foo", "bar")
if (status == as_layer.AS_LAYER_OK) then
    ngx.say("Set binval ok")
end

Read record

local rec, status = as_layer.as_get_record(as_connection, asKey)
if (status == as_layer.AS_LAYER_OK) then
    ngx.say("Get record = " .. json:encode(rec))
end

About

Calling Aerospike from Lua

Resources

Stars

Watchers

Forks

Packages

No packages published
0