An awesome gem which provides utility methods for redis db. Can be used with any rails application which is using redis.
Add this line to your application's Gemfile:
gem 'redis_utility'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install redis_utility
After installing the gem create a file redis_utility.rb in config/initializers with following content:
RedisUtility.redis_config = { host: 'localhost', timeout: 60, db: 'redis_db', password: 'password'}
Following are use cases:
RedisUtility.redis
RedisUtility.reconnect
RedisUtility.import_data('import_file.ljson')
RedisUtility.export_data('Car_Acura|CL|*', 'ouput_export_file.ljson')
RedisUtility.cache_string('cache_this', { expire: 20 }) { 'the value of block passed' }
RedisUtility.cache('cache_multi_json', { expire: 20 }) { '{"Car_Acura|CL|":"01010000_EE000000000","Car_Acura|CL|L4-2.2L":"01010100_2000000000"}' }
RedisUtility.export_string_data('Car_Acura|CL|*', 'string_export_file.ljson')
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/redis_utility. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the RedisUtility project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.