I am trying to implement cache in my rails 4 app. I installed redis, setup config according this article but every time I try to cache something in my controller, on first refresh I get data, on second I get nil. When I go to redis cli and I do KEYS * I see that key is there.
I thought it is my problem of redis so I disabled redis and in development.rb put just
config.cache_store = :memory_store, { size: 128.megabytes }
but if I try to
Rails.cache.fetch("dashboard") do
User.where(:active=>true).size
end
I get nil as response to my action.
What am I doing wrong that cache returns me always nil ?
Edit: this is part of my development.rb file for redis
config.cache_store = :redis_store, {
expires_in: 1.hour,
namespace: 'cache',
redis: { host: 'localhost', port: 6379, db: 0 },
}