Skip to content

ankane/ignite-ruby

Repository files navigation

Ignite Ruby

🔥 Ruby client for Apache Ignite

Build Status

Installation

Add this line to your application’s Gemfile:

gem "ignite-client"

Getting Started

Create a client

client = Ignite::Client.new

See connection options for more info

Key-Value API

Create a cache

cache = client.get_or_create_cache("test")

Add data

cache.put("hello", "world")
cache.get("hello")

Supports these methods

cache.get(key)
cache.get_all(keys)
cache.put(key, value)
cache.put_all(objects)
cache.key?(key)
cache.keys?(keys)
cache.get_and_put(key, value)
cache.get_and_replace(key, value)
cache.get_and_remove(key)
cache.put_if_absent(key, value)
cache.get_and_put_if_absent(key, value)
cache.replace(key, value)
cache.replace_if_equals(key, compare, value)
cache.clear
cache.clear_key(key)
cache.clear_keys(keys)
cache.remove_key(key)
cache.remove_if_equals(key, compare)
cache.size
cache.remove_keys(keys)
cache.remove_all

Scan Queries

Scan objects

cache.scan do |k, v|
  # ...
end

SQL

Execute SQL queries

client.query("SELECT * FROM users")

Pass arguments

client.query("SELECT * FROM products WHERE name = ?", ["Ignite"])

Connection Options

Specify the host and port

Ignite::Client.new(host: "localhost", port: 10800)

Specify the connect timeout

Ignite::Client.new(connect_timeout: 3)

Authentication

For authentication, use:

Ignite::Client.new(username: "ignite", password: "ignite")

SSL is automatically enabled when credentials are supplied. To disable, use:

Ignite::Client.new(username: "ignite", password: "ignite", use_ssl: false)

SSL/TLS

For SSL/TLS, use:

Ignite::Client.new(
  use_ssl: true,
  ssl_params: {
    ca_file: "ca.pem"
  }
)

Supports all OpenSSL params

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone https://github.com/ankane/ignite-ruby.git
cd ignite-ruby
bundle install
bundle exec rake test

About

Ruby client for Apache Ignite

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages