Sha256: 26def954b2704eee455f0e2c73d9bba66492539ea6de9f3ec4afbd4057053fd4

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'redis-datapump'
require 'multi_json'

options = {
  redis_url: 'redis://localhost:6379',
}

OptionParser.new do |opts|
  opts.banner = "Usage: redis-export [options]"

  opts.on('-u', '--uri=URI', 'Redis URI in format redis://hostname[:port]') do |u|
    options[:redis_url] = u
  end

  opts.on('-d', '--database=DB', 'Redis database to export') do |d|
    options[:redis_database] = d
  end
end.parse!

json_engine = RUBY_PLATFORM == 'java' ? :jr_jackson : :yajl

MultiJson.use json_engine

importer = RedisDatapump::Importer.new(options)
ARGF.each do |line|
  importer.import(MultiJson.load(line))
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redis-datapump-0.1.0.alpha1 bin/redis-import