<commit_before># Aerospike Ruby Client

An Aerospike library for Ruby.

This library is compatible with Ruby 1.9.3+ and supports Linux, Mac OS X and various other BSDs. Rubinius is supported, but not JRuby - yet.


- [Usage](#Usage)
- [Prerequisites](#Prerequisites)
- [Installation](#Installation)
- [Tweaking Performance](#Performance)
- [Benchmarks](#Benchmarks)
- [API Documentaion](#API-Documentation)
- [Tests](#Tests)
- [Examples](#Examples)
  - [Tools](#Tools)


## Usage:

The following is a very simple example of CRUD operations in an Aerospike database.

```ruby
require 'rubygems'
require 'aerospike'

include Aerospike

client = Client.new("127.0.0.1", 3000)

key = Key.new('test', 'test', 'key value')
bin_map = {
  'bin1' => 'value1',
  'bin2' => 2,
  'bin4' => ['value4', {'map1' => 'map val'}],
  'bin5' => {'value5' => [124, "string value"]},
}

client.put(key, bin_map)
record = client.get(key)
record.bins['bin1'] = 'other value'

client.put(key, record.bins)
record = client.get(key)
puts record.bins

client.delete(key)
puts client.exists(key)

client.close
```

More examples illustrating the use of the API are located in the
[`examples`](examples) directory.

Details about the API are available in the [`docs`](docs) directory.

<a name="Prerequisites"></a>
## Prerequisites

[Ruby](https://ruby-lang.org) version v1.9.3+ is required.

Aerospike Ruby client implements the wire protocol, and does not depend on the C client.
It is thread friendly.

Supported operating systems:

- Major Linux distributions (Ubuntu, Debian, Redhat)
- Mac OS X
- other BSDs (untested)

<a name="Installation"></a>
## Installation from Ruby gems:

1. gem install aerospike

## Installation from source:

1. Install Ruby 1.9.3+
2. Install RubyGems
3. Install Bundler: ```gem install bundler```
4. Install dependencies: ```bundler install```
5. Build and Install the gem locally: ```rake build && rake install```
6. Run the benchmark: ```./tools/benchmark/benchmark.rb -u```

<a name="Performance"></a>
## Performance Tweaking

We are bending all efforts to improve the client's performance. In out reference benchmarks, Go client performs almost as good as the C client.

To read about performance variables, please refer to [`docs/performance.md`](docs/performance.md)

<a name="Log"></a>
## Log

Aerospike show `INFO` messages on log with information about the status of the cluster. If you need to disable this messages, create a initializer file and set `tend_info`config variable to false. For example, if you are using Rails, you can create file on `config/initializers/aerospike.rb` and set this content:

```ruby
# Initialize material icons setup
Aerospike.setup do |config|
  # This will disable tend logs
  config.tend_info = false
end<commit_msg>Fixed typo error on README<commit_after># Aerospike Ruby Client

An Aerospike library for Ruby.

This library is compatible with Ruby 1.9.3+ and supports Linux, Mac OS X and various other BSDs. Rubinius is supported, but not JRuby - yet.


- [Usage](#Usage)
- [Prerequisites](#Prerequisites)
- [Installation](#Installation)
- [Tweaking Performance](#Performance)
- [Benchmarks](#Benchmarks)
- [API Documentaion](#API-Documentation)
- [Tests](#Tests)
- [Examples](#Examples)
  - [Tools](#Tools)


## Usage:

The following is a very simple example of CRUD operations in an Aerospike database.

```ruby
require 'rubygems'
require 'aerospike'

include Aerospike

client = Client.new("127.0.0.1", 3000)

key = Key.new('test', 'test', 'key value')
bin_map = {
  'bin1' => 'value1',
  'bin2' => 2,
  'bin4' => ['value4', {'map1' => 'map val'}],
  'bin5' => {'value5' => [124, "string value"]},
}

client.put(key, bin_map)
record = client.get(key)
record.bins['bin1'] = 'other value'

client.put(key, record.bins)
record = client.get(key)
puts record.bins

client.delete(key)
puts client.exists(key)

client.close
```

More examples illustrating the use of the API are located in the
[`examples`](examples) directory.

Details about the API are available in the [`docs`](docs) directory.

<a name="Prerequisites"></a>
## Prerequisites

[Ruby](https://ruby-lang.org) version v1.9.3+ is required.

Aerospike Ruby client implements the wire protocol, and does not depend on the C client.
It is thread friendly.

Supported operating systems:

- Major Linux distributions (Ubuntu, Debian, Redhat)
- Mac OS X
- other BSDs (untested)

<a name="Installation"></a>
## Installation from Ruby gems:

1. gem install aerospike

## Installation from source:

1. Install Ruby 1.9.3+
2. Install RubyGems
3. Install Bundler: ```gem install bundler```
4. Install dependencies: ```bundler install```
5. Build and Install the gem locally: ```rake build && rake install```
6. Run the benchmark: ```./tools/benchmark/benchmark.rb -u```

<a name="Performance"></a>
## Performance Tweaking

We are bending all efforts to improve the client's performance. In out reference benchmarks, Go client performs almost as good as the C client.

To read about performance variables, please refer to [`docs/performance.md`](docs/performance.md)

<a name="Log"></a>
## Log

Aerospike show `INFO` messages on log with information about the status of the cluster. If you need to disable this messages, create a initializer file and set `tend_info`config variable to false. For example, if you are using Rails, you can create file on `config/initializers/aerospike.rb` and set this content:

```ruby
# Initialize Aerospike setup
Aerospike.setup do |config|
  # This will disable tend logs
  config.tend_info = false
end
{'fraction_non_alphanumeric': 0.12861271676300579, 'fraction_numerical': 0.014089595375722543, 'mean_word_length': 4.684804928131417, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 31, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6900808', 'n_tokens_mistral': 1858, 'n_tokens_neox': 1713, 'n_words': 650}