Rails.cache.write(‘name’,‘Hello this is string’ , :expires_in => 1.week)
Rails.cache.read(‘name’)
i use these syntax but always it’s nil
=> nil
Rails.cache.write(‘name’,‘Hello this is string’ , :expires_in => 1.week)
Rails.cache.read(‘name’)
i use these syntax but always it’s nil
=> nil
What do you get if you just as for the cache store in a console?
Rails.cache # e.g. => #<ActiveSupport::Cache::ResilientRedisStore...>
You might not have set you
config.cache_store
to anything in your config/application.rb
. Try setting it to :memory_store
.
As @madsohm suggested,
In your: config/environments/development.rb
(it can also be production.rb
or others):
config.cache_store = :memory_store, { size: 64.megabytes }
You can also do a quick read here.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs