Rails action caching with querystring parameters

前端 未结 3 1294
滥情空心
滥情空心 2020-11-30 19:20

How can I cache my REST controller with Rails where my actions have query string parameters?

Example: GET /products/all.xml?max_price=200

T

3条回答
  •  孤街浪徒
    2020-11-30 20:00

    In this case you should use fragments caching:

    in your controller:

    cache(params[:max_price], :expires_in => 10.minute) do
      # get the result
    end
    

提交回复
热议问题