AerospikeNative
Ruby aerospike client with c extension
Installation
Add this line to your application's Gemfile:
gem 'aerospike_native'
And then execute:
$ bundle
Or install it yourself as:
$ gem install aerospike_native
Current status
operatecommand with all operation typesputcommandgetcommandremovecommandselectcommandexixts?commandwherecommand (query support)- :disappointed: Raw (bytes) type is not supported
- Supported policies with all parameters for described commands
- Supported digest keys
- Supported exceptions (
AerospikeNative::Exception) with several error codes constantsAerospikeNative::Exception.constants - Index management (
create_indexanddrop_index)
Usage
require 'aerospike_native'
client = AerospikeNative::Client.new([{'host' => '127.0.0.1', 'port' => 3000}])
key = AerospikeNative::Key.new('test', 'test', 'sample')
client.put(key, {'bin1' => 1, 'bin2' => 'test'}, {'timeout' => 1})
client.operate(key, [AerospikeNative::Operation.write('bin3', 25), AerospikeNative::Operation.increment('bin1', 2), AerospikeNative::Operation.append('bin1', '_aerospike')], {'timeout' => 1})
client.exists?(key)
record = client.get(key)
record = client.select(key, ['bin2', 'bin1'])
client.remove(key)
10.times do |i|
client.put(AerospikeNative::Key.new('test', 'test', "key#{i}"), {'number' => i, 'name' => 'key'})
end
client.create_index('test', 'test', 'number', 'number_idx');
records = []
client.where('test', 'test', [AerospikeNative::Condition.range("number", 1, 7)]) { |record| records << record }
records
Contributing
- Fork it ( https://github.com/rainlabs/aerospike_native/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request