Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3694338
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:29:05+00:00 2026-05-19T04:29:05+00:00

I am creating a web-based IMAP client in Rails, and want to cache the

  • 0

I am creating a web-based IMAP client in Rails, and want to cache the IMAP object between requests. I was planning to serialize the object and save it in Redis (since it caches strings only), however none of the popular serialization methods seems to be working.

Marshal and ActiveSupport::Cache::MemoryStore both give the following error

Marshal.dump(imap)
TypeError: no marshal_dump is defined for class Mutex

YAML serialization works, but deserializing fails.

s = YAML::dump(imap) # works, i.e. loads up a string with the imap data
imap2 = YAML::load(s)
TypeError: allocator undefined for Thread

Is there any other alternate caching mechanism that works for arbitrary ruby objects, especially ones that might be using threads internally? Does an alternate key-value store (I have been using Redis) support such caching?
Even better, is there anyway for Rails to remember certain objects, rather than me deserializing them?

PS> I am using Ruby 1.9.2 with Rails 3.0.3 on a Macbook, if that helps in any way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:29:06+00:00Added an answer on May 19, 2026 at 4:29 am

    Serializing only works for data objects (or part of the data of an object). Network connections can’t be serialized, since they are very specific to a client, server and time (by default a tcp connection times out after 5 minutes). You could use a global IMAP connection that you put in memory within your application, but you might run into issues there with several users. The most standard way is to have a pool of connections where you borrow a connection from.
    By the way, are you running into issues when creating a connection every time? I would not cache the connection, but the data that you retrieved via IMAP and work from there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get more inspiration and ideas for creating web based business applications.
I am creating a web based email client using c# asp.net. What is confusing
I am creating a web-based RESTful service and want to cloud-enable it for scalability.
I'm involved in creating a web based business solution. The idea is that the
When creating a web application, and lets say you have a User object denoting
I'm creating a web based system which will be used in countries from all
I have been tasked with the job of creating a web based system to
I am creating a web based Mock test paper, which needs to be fairly
I'm creating a web application installer using WiX. I want to allow the user
When creating web parts for Sharepoint, is it better to create an actual web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.