# File lib/familia/tools.rb, line 5
    def move_keys(filter, source_uri, target_uri, &each_key)
      if target_uri == source_uri
        raise "Source and target are the same (#{target_uri})"
      end
      Familia.connect target_uri
      source_keys = Familia.redis(source_uri).keys(filter)
      puts "Moving #{source_keys.size} keys from #{source_uri} to #{target_uri} (filter: #{filter})"
      source_keys.each_with_index do |key,idx|
        type = Familia.redis(source_uri).type key
        ttl = Familia.redis(source_uri).ttl key
        if source_uri.host == target_uri.host && source_uri.port == target_uri.port
          Familia.redis(source_uri).move key, target_uri.db
        else
          case type
          when "string"
            value = Familia.redis(source_uri).get key
          when "list"
            value = Familia.redis(source_uri).lrange key, 0, -1
          when "set"
            value = Familia.redis(source_uri).smembers key
          else
            raise Familia::Problem, "unknown key type: #{type}"
          end
          raise "Not implemented"
        end
        each_key.call(idx, type, key, ttl) unless each_key.nil?
      end
    end