Sha256: 8ff4de826b6c619736949b282c46f112fda5c2bfe210a7017840db9d8f393585
Contents?: true
Size: 766 Bytes
Versions: 3
Compression:
Stored size: 766 Bytes
Contents
# encoding: utf-8 module RedisCopy module Strategy class New include Strategy def copy(key) 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 def self.compatible?(redis) maj, min, *_ = redis.info['redis_version'].split('.').map(&:to_i) return false unless maj >= 2 return false unless min >= 6 return true end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
redis-copy-0.0.3 | lib/redis-copy/strategy/new.rb |
redis-copy-0.0.2 | lib/redis-copy/strategy/new.rb |
redis-copy-0.0.1 | lib/redis-copy/strategy/new.rb |