Sha256: 3a96f0b2803778df95c5b14903888edcd94776553047849bb23e7e5328899429
Contents?: true
Size: 919 Bytes
Versions: 3
Compression:
Stored size: 919 Bytes
Contents
# encoding: utf-8 module RedisCopy module Strategy class DumpRestore implements Strategy do |source, destination, *_| [source, destination].all? do |redis| bin_version = Gem::Version.new(redis.info['redis_version']) bin_requirement = Gem::Requirement.new('>= 2.6.0') next false unless bin_requirement.satisfied_by?(bin_version) true end end def copy(key) @ui.debug("COPY: #{key.dump}") ttl = @src.ttl(key) # TTL returns seconds, -1 means none set # RESTORE ttl is in miliseconds, 0 means none set translated_ttl = (ttl && ttl > 0) ? (ttl * 1000) : 0 dumped_value = @src.dump(key) @dst.restore(key, translated_ttl, dumped_value) return true rescue Redis::CommandError => error @ui.debug("ERROR: #{error}") return false end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
redis-copy-1.0.0 | lib/redis-copy/strategy/dump-restore.rb |
redis-copy-1.0.0.rc.1 | lib/redis-copy/strategy/dump-restore.rb |
redis-copy-1.0.0.rc.0 | lib/redis-copy/strategy/dump-restore.rb |