I want ask best way to count view when 1 page 开发者_如何学Cis cached in cakePHP.
When a page is cached , I use javascript send request to server to + view for post. But i think it cause server is overload.
Mike Han's response is incorrect. Cached pages in Cake also bypass app_controller. you will need to do an ajax call from the cached page to some action which increments your view-count database field.
I suspect controller is still in action though the view is cached. Or at least beforeFilter of app controller may still be working. You could do the count there.
精彩评论