Rails.cache.read unmarshal everything as string

This problem prevents me from using Rails.cache to store objects other
than string. This used to work fine with Ruby 1.8 and Rails 2.3.
However, with my new setup migrating to Ruby 1.9.2 or 1.9.3 and Rails
3.1.1 I now get this problem.

Please also note that Rails.cache is using memcache in the backend.

drjoke-7:atcloud.com atip$ /opt/ruby-1.9.2/bin/rails console
Loading development environment (Rails 3.1.1)

irb(main):001:0> user = User.find 1
User Load (0.5ms) SELECT users.* FROM users WHERE users.id = 1 LIMIT 1
=> # User id: 1, nickname: "จอมยุทธ์", username: "jomyoot", created_at:
nil, updated_at: "2011-09-30 13:23:29", active_at: "2011-09-30
13:23:29", homepage_views: 175458, score: 5842, level: 8, stars: 6,
remaining_story_votes: 8, remaining_story_comment_votes: 16,
remaining_stars: 1, latest_tweeter_content: "asdde"

irb(main):002:0> Rails.cache.write "test", user
=> true

irb(main):003:0> test = Rails.cache.read "test"
=> "\x04\bo:
ActiveSupport::Cache::Entry\t:\x10@compressedF:\x10@expires_in0:\x10@created_atf\x1A1320470467.1405299\x00\xFEq:\v@valueo:\tUser\x10:\x10@attributes{&I\"\aid\x06:\x06ETi\x06I\"\rnickname\x06;\fTI\"\x1D\xE0\xB8\x88\xE0\xB8\xAD\xE0\xB8\xA1\xE0\xB8\xA2\xE0\xB8\xB8\xE0\xB8\x97\xE0\xB8\x98\xE0\xB9\x8C\x06;\fTI\"\rusername\x06;\fTI\"\fjomyoot\x06;\fTI\"\x0Fcreated_at\x06;\fT0I\"\x0Fupdated_at\x06;\fTIu:\tTime\r\xCD\xE3\e\xC0\x00\x00\xD0]\x06:\v@_zone\"\bUTCI\"\x0Eactive_at\x06;\fTIu;\r\r\xCD\xE3\e\xC0\x00\x00\xD0]\x06;\x0E\"\bUTCI"

irb(main):004:0> test.class
=> String

I would like to add a further notice that the problem seems to occur
only with Rails ActiveRecord model. I have no problem unmarshalling a
Date class.

irb(main):005:0> d = Date.new
=> Mon, 01 Jan -4712
irb(main):006:0> Rails.cache.write "date", d
=> true
irb(main):007:0> x = Rails.cache.read "date"
=> Mon, 01 Jan -4712
irb(main):008:0> x.class
=> Date