Adapter for Cassanity. Defaults consistency to :quorum.
require 'adapter/cassanity'
client = Cassanity::Client.new(['127.0.0.1'], 9160)
keyspace = client.keyspace('adapter_cassanity')
keyspace.recreate
apps = keyspace.column_family(:apps, {
schema: Cassanity::Schema.new({
primary_key: :id,
columns: {
id: :timeuuid,
name: :text,
}
}),
})
apps.create
client = apps
adapter = Adapter[:cassanity].new(client)
adapter.clear
id = Cql::TimeUuid::Generator.new.next
adapter.read(id) # => nil
adapter.write(id, name: 'GitHub')
adapter.read(id) # => {'id' => ..., 'name' => 'GitHub'}
adapter.delete(id)
adapter.read(id) # => nil
adapter.write(id, name: 'GitHub')
adapter.read(id) # => {'id' => ..., 'name' => 'GitHub'}
adapter.clear
adapter.read(id) # => nil
Add this line to your application's Gemfile:
gem 'adapter-cassanity'
And then execute:
$ bundle
Or install it yourself as:
$ gem install adapter-cassanity
- Fork it
- 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 new Pull Request