A JRuby wrapper around the Jedis client library for Redis. Requires JRuby.
Add this line to your application's Gemfile:
gem 'jedis_rb'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jedis_rb
RedisPool = JedisRb::Pool.new
=> #<JedisRb::Pool:0x19fe4644 @pool=#<Java::RedisClientsJedis::JedisPool:0x21d8bcbe>>
RedisPool.execute(:ping)
=> "PONG"
RedisPool.execute :get, 'foo'
=> nil
RedisPool.execute :set, 'foo', 'fish'
=> "OK"
RedisPool.execute :get, 'foo'
=> "fish"
RedisPool.execute :setex, 'foo', 600, 'fish'
=> "OK"
Or reusing one connection, in a block:
RedisPool.yield_connection do |c|
c.set ..., ...
c.sadd ..., ...
c.get ...
end
Bug reports and pull requests are welcome on GitHub at https://github.com/asmallworldsite/jedis_rb.
The gem is available as open source under the terms of the MIT License.