thiagofm
thiagofm

Reputation: 5883

How to get rails config.cache_store config in a Gem?

So, I'm developing my first gem that needs some real connection with rails. It needs to know what is configured into config.cache_store. How do I get this info?

A little more background about it: it's a memcached manager(compatible only with Dalli gem, on it's first version) like resque-web for resque. I've tried reading resque code and it's case is different as it has a initializer for it and the Redis config is loaded from a yml file.

Thanks in advance.

Upvotes: 0

Views: 207

Answers (1)

Winfield
Winfield

Reputation: 19145

config.cache_store is loaded into two different places:

Rails.cache
ActionController::Base.cache_store

...which are both defaulted from config.cache_store, but can optionally be configured separately. You should be able to inspect one/both of these depending on what you need to determine the cache config at runtime.

Upvotes: 1

Related Questions