I've configured the development.rb file like this:
# Enable/disable caching. By default caching is disabled.
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800'
}
(erased the default config that checks for a file just to test)
Then I open a rails console
to test this but it does not seem to be working:
[1] pry(main)> Rails.cache.write("asd", "asd")
=> true
[2] pry(main)> Rails.cache.read("asd")
=> nil
I've managed to make it work a couple of days ago, but now it is not working.
A I missing something?
I fixed it by restarting spring. Doing
> spring stop
Spring stopped.
> spring start
does the trick.
Note: when starting spring again, it may fail, but it'll work anyway.
In rails 6.1.4
run rails dev:cache
to toggle caching in development
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With