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 7065977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:01:32+00:00 2026-05-28T05:01:32+00:00

I am using memcached (gem memcache-client ) in my application, but I want to

  • 0

I am using memcached (gem memcache-client) in my application, but I want to use the memory cache store at the same time. I currently have the following in my application.rb:

config.cache_store = :mem_cache_store, {:namespace => "my_namespace_#{Rails.env}"}

and this works fine with commands such as Rails.cache.write(...)

How can I use the ActiveSupport::Cache::MemoryStore for some of my models, and at the same time use memcached for other reasons as I do until now?

I know that ActiveSupport::Cache.lookup_store will return to me a new MemoryStore object. However, I do not know how to continue from this point on? For example, where do I put this command? Where do I store the resulting object? How do I access this object later on from inside my model code? Or shall I follow a completely different way?

Thanks in advance for your help.

  • 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-28T05:01:33+00:00Added an answer on May 28, 2026 at 5:01 am

    Rails.cache is just a cache store that is created for your convenience. There’s nothing stopping you doing something like

    ::MEMORY_STORE = ActiveSupport::Cache::MemoryStore.new
    

    and then when you want to use that store instead of Rails.cache you would do

    MEMORY_STORE.fetch('some_key') {}
    

    Although, as @leonardoborges commented, I’m not sure why you would want to do this

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

Sidebar

Related Questions

I use the cache-money gem for transparent usage of Memcached. Using the supplied config
I'm considering using memcached (at some point) in my application i'm currently developing. Eventually,
I'm using Memcached in a CakePHP application to cache MySQL result sets. One result
I am using Memcached as an Object Store with my Rails application where I
After saving a String value into memcached using the Danga client, I attempted to
I'm using memcache to design a cache for the model layer of a web
I want to start using memcache with PHP (on Ubuntu 9.10). There are lots
I'm testing out using memcached to cache django views. How can I tell if
I was thinking about using memcached to store sessions instead of mySQL, which seemed
I had some thoughts back ago about using memcached for session storage, but came

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.