Skip to content
ReJSON adapter/client for Ruby. Store/Retrieve JSON documents in Redis database using Ruby
Ruby Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
spec
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
Gemfile
LICENSE.txt
README.md
Rakefile
rejson-rb.gemspec

README.md

RedisJSON Ruby Client Build Status

rejson-rb is a package that allows storing, updating and querying objects as JSON documents in a Redis database that is extended with the ReJSON module. The package extends redis-rb's interface with ReJSON's API, and performs on-the-fly serialization/deserialization of objects to/from JSON.

Installation

Add this line to your application's Gemfile:

gem 'rejson-rb'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install rejson-rb

Usage

Make sure you have loaded rejson module in redis.conf

require 'rejson'

rcl = Redis.new # Get a redis client

# Get/Set keys
rcl.json_set "test", ".", "{:foo => 'bar', :baz => 'qux'}"
# => "OK" 
rcl.json_get "test", Rejson::Path.root_path
# => "{:foo => 'bar', :baz => 'qux'}" 
rcl.json_del "test"
# => 0 

# Use similar to redis-rb client
rj = rcl.pipelined do
  rcl.set "foo", "bar"
  rcl.json_set "test", ".", "{:foo => 'bar', :baz => 'qux'}"
end
# => ["OK", "OK"] 

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/vachhanihpavan/rejson-rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

For complete documentation about ReJSON's commands, refer to ReJSON's website.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Rejson::Rb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

You can’t perform that action at this time.