Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure and define Cache strategy #2

Open
jrjoacir opened this issue Feb 6, 2021 · 0 comments
Open

Configure and define Cache strategy #2

jrjoacir opened this issue Feb 6, 2021 · 0 comments

Comments

@jrjoacir
Copy link
Owner

jrjoacir commented Feb 6, 2021

  • Configure (config/environments/development.rb): # Run rails dev:cache to toggle caching.
    • Use:
      Rails.cache.fetch("users/#{params[:id]}", expires_in: 1.minute) do
      User.find(params[:id])
      end

      The key can url_for (return url in controller) method plus query_string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant