An object cache is like magic: put an object into the box and it comes back later, exactly as it went in. The magic is seductive because it makes things so easy.
It only takes a bit of thought, however, to see the dangers of this trick. Class names can change; a method can return a different result. Objects exist in a universe, and that universe is constantly evolving.
Marshal, Ruby's default binary serialization library, does not handle changes like this gracefully. We discovered this recently when a code change collided with a cached class, leading to a fire in production.
To avoid incidents like this, we switched the cache serializer in our core Rails monolith from Marshal to MessagePack, an alternative, generic binary serializer. MessagePack has a more compact format than Marshal, with stricter typing and less magic.
In this talk, I'll crack open MessagePack to show how it works, how we migrated to it, and why you might want to do the same.