Class: RedisCopy::Strategy::DumpRestore
- Inherits:
-
Object
- Object
- RedisCopy::Strategy::DumpRestore
- Defined in:
- lib/redis-copy/strategy/dump-restore.rb
Instance Method Summary collapse
Instance Method Details
#copy(key) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/redis-copy/strategy/dump-restore.rb', line 17 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 |