开发者

Rails Page Caching with a hits/views counter. How?

I want to use rails page caching to speed up a application which encounters heavy load. But I also need to count the hits/views on the objects presented. So I have the model "Article" with a unique hit counter method (by IP) which is called every time the user hits the show action. That doesn't work with caching, so I'm wondering 开发者_如何转开发about the right way to solve this problem. There is no need for the counter to show real-time results.

Thoughts so far:

  • Use Cron and a Rake task to analyze the log/production.log file
  • Write to a custom log (how? using nginx)

Thanks for any input, ideas or best practice examples!


Custom logging is pretty simple with nginx. Have a look at the logging module wiki.

I'd just use that (or parse the default) on a cron job and go from there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜