Sha256: f28d4473ab809380bee9e44cd02c02942846e66a199c6e7ffd82b2fa0815779c

Contents?: true

Size: 652 Bytes

Versions: 1

Compression:

Stored size: 652 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

RedisDatapump::Exporter.new(options).export do |value|
  $stdout.puts MultiJson.dump(value, pretty: false)
end

Version data entries

1 entries across 1 versions & 1 rubygems

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