Laravel中的会话ID有多独特?

问题描述:

I am keeping track of article hits by storing each page view in a table along with the session ID, I then use the session ID to weed out (count(distinct session)) multiple hits in the users session lifetime.

But how unique is the Laravel session ID? Should I also take other things into consideration, such as the time to avoid incorrect grouping?

Update: I adjusted my SQL to take the date into account as well:

select count(distinct session, DATE(created_at)) as aggregate from `article_views` where `article_id` = ? and `agent` NOT LIKE '%bot%'

我通过将每个页面视图与会话ID一起存储在表中来跟踪文章命中,然后我使用 要清除的会话ID( count(distinct session) code>)用户会话生命周期中的多次点击。 p>

但是Laravel会话ID有多独特? 我是否还应考虑其他因素,例如避免错误分组的时间? p>

更新 strong>我调整了SQL以将日期考虑在内 : p>

  select count(distinct session,DATE(created_at))作为`article_views`的汇总,其中`article_id` =? 和`agent` NOT LIKE'%bot%'
  code>  pre> 
  div>

Session ID is pretty unique, it can be duplicated, but the probability is very low. If you have a website with a fair traffic, it may happens once in you web site life, and will just annoy one user for one session. This is not worth to care about unless you expect to build a very high traffic website.