Ruby Marshallng 是否有可能与不同版本的 ruby 一起工作?

Is it possible that Ruby Marshallng may work differently with different versions of ruby?

我需要将复杂的对象(https://github.com/nepalez/ebay_api - EbayAPI 对象可能有大量数据)发送到 sidekiq。因此,编组看起来是一个很好的解决方案。我担心的是:Ruby 封送处理是否可能与不同版本的 ruby 一起工作?

所以,总有一天我会更新ruby版本,由于load marshaled object和原来的object会不一样,像之前marshaled一样,有可能吗?

我最近在从 Rails 3.2 迁移到 Rails 4 期间遇到 Rails 缓存问题。应用程序无法从缓存中读取 AR 模型(同时更简单的对象像哈希一样,数组工作得很好)。但是 ruby 是一样的。

所以请注意可能会出现一些问题,所以最好尝试一下。

我建议用一个版本的 ruby 将编组对象保存在文件中,然后用另一个版本读取。

"Note, however, that the binary format used by Marshal.dump and Marshal.load is version dependent, and newer versions of Ruby are not guaranteed to be able to read marshalled objects written by older versions of Ruby."(Ruby 编程语言,David Flanagan 和 Yukuhiro Matsumoto,第 83 页)。