0

我一直在阅读有关实现命中计数器的各种方法。我最喜欢的是为特定用户设置会话/cookie 标志,以指示他/她是否访问了特定页面。如果未设置标志,我将设置它并将页面的点击数增加 1。

I know the above method is fine, but I also understand that it will always have a workaround. But if I use a dedicated table with a unique constraint on a combination of page_id and ip_address, it should work most efficiently when used with a combination of a session flag. But considering the site I am working on has about a 20000 hits a day (which isn't a lot, but enough to flood my hits table), is it worth flooding MySQL with ip addresses just to capture hits?

Also, is there a better way of capturing legit hits other than these?

4

1 回答 1

0

我认为为此设置专门的桌子实在是太费力了。仅在确实需要时才这样做。否则只是浪费时间和资源。现有表中的字段会增加,最终禁用刷新时增加的 cookie 就可以了。

于 2013-06-22T21:22:10.787 回答