Page View Counter like on StackOverFlow

后端 未结 7 1162
一向
一向 2020-12-04 20:19

What is the best way to implement the page view counter like the ones they have here on the site where each question has a \"Views\" counter?

Factoring in Performanc

7条回答
  •  醉酒成梦
    2020-12-04 21:12

    Instead of making a database call everytime the database is hit, I would increment a counter using a cache object and depending on how many visits you get to your site every day you have send the page hits to the database every 100th hit to the site. This is waay faster then updating the database on every single hit.

    Or another solution is analyzing the IIS log file and updating hits every 30min through a windows service. This is what I have implemented and it work wonders.

提交回复
热议问题