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

  • SEARCH
  • Home
  • 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 4003930
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:12:42+00:00 2026-05-20T08:12:42+00:00

I am using redis as my web cache, and I want to store those

  • 0

I am using redis as my web cache, and I want to store those activerecord objects to redis directly, but using redis-rb I get an error.

It seems that I can’t serialize it or some what. Is there a lib to do this for me?
Am I have to serialize it to json format?

Which serialization format would be the most efficient?

  • 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-20T08:12:42+00:00Added an answer on May 20, 2026 at 8:12 am

    Redis stores strings (and a few other data structures of strings); so you can serialize into Redis values however you like so long as you end up with a string.

    JSON is probably the best place to start as it’s lean, not overly brittle, works well with live upgrade patterns, and is readable in situ. Later you can add more complexity to meet your goals as needed, e.g., compression. #to_json and #from_json are already on ActiveRecord if you want to use JSON (with YAJL or its ilk that shouldn’t be excessively slow, relatively speaking.) #to_xml is also there, if you’re into S&M.

    Raw marshaling can also work, but occasionally goes horrifically wrong (I’ve had marshaled objects exceed 2MB after LZO compression that were only a few K in JSON.)

    If it’s really a bottleneck for you, you’ll want to run your own efficiency tests for your goal(s), e.g., write speed, read speed, or storage size, with your own objects and data patterns.

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

Sidebar

Related Questions

I'm using redis to store hashes with ~100k records per hash. I want to
I have the following express node.js app. It's using the 'redis' npm package. app.get(/test,function(req,res){
I'm using resque-status for Resque/Redis... https://github.com/quirkey/resque-status I basically want to create a new Sinatra
I'm currently using Socket.IO with redis store. And I'm using Room feature with it.
I am using Redis to store two databases : 0 and 1 via the
I am new to Redis (using it at a hosted service) and want to
I am using nginx, web.py, fastcgi, and redis as my stack. Upon a post
Now that Stack Overflow uses redis, do they handle cache invalidation the same way?
I am creating a web-based IMAP client in Rails, and want to cache the
My web application is using redis for the main database. It's very nice in

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.