当前位置:网站首页>Redis does web page UV statistics
Redis does web page UV statistics
2022-08-01 20:01:00 【Mar, time flies】
Article table of contents
Foreword
First of all, we must understand what UV is, that is, independent visitor records (the same user visits the same page multiple times, and only counts the page has been visited once by this user), which requires the redis data type we use to have a deduplication function.It is recommended to use HyperLogLog implementation
Use set to achieve
Assume user 1 visits page A three times
# 1 for user idsadd A:20220801 1sadd A:20220801 1sadd A:20220801 1
Statistical UV of page A
# UV = 1scard A: 20220801
Use hash to achieve
Assume user 1 visits page A three times
# The last 1 can also be filled with others, it is only used as a placeholderhset A:20220802 1 1hset A:20220802 1 1hset A:20220802 1 1
Statistical UV of page A
# UV = 1hlen A: 20220802
Implementation with HyperLogLog
The advantage of HyperLogLog is that when the number or volume of input elements is very, very large, the space required to calculate the cardinality is always fixed and small.
Assume user 1 visits page A three times
# Add three 1s at a timepfadd A:20220803 1 1 1
Statistical UV of page A
# UV = 1pfcount A: 20220803
边栏推荐
猜你喜欢
58:第五章:开发admin管理服务:11:开发【管理员人脸登录,接口】;(未实测)(使用了阿里AI人脸识别)(演示了,使用RestTemplate实现接口调用接口;)
使用微信公众号给指定微信用户发送信息
专利检索常用的网站有哪些?
【多任务模型】Progressive Layered Extraction: A Novel Multi-Task Learning Model for Personalized(RecSys‘20)
我的驾照考试笔记(2)
ThreadLocal讲义
安全作业7.25
我的驾照考试笔记(3)
MySQL你到底都加了什么锁?
泰德制药董事长郑翔玲荣膺“2022卓越影响力企业家奖” 泰德制药荣获“企业社会责任典范奖”
随机推荐
openresty 动态黑白名单
ThreadLocal讲义
【nn.Parameter()】生成和为什么要初始化
面试突击70:什么是粘包和半包?怎么解决?
环境变量,进程地址空间
瀚高数据导入
Find the sum of two numbers
手撸代码,Redis发布订阅机制实现
C语言实现-直接插入排序(带图详解)
我的驾照考试笔记(2)
【社媒营销】如何知道自己的WhatsApp是否被屏蔽了?
【kali-信息收集】(1.5)系统指纹识别:Nmap、p0f
Win10, the middle mouse button cannot zoom in and out in proe/creo
57:第五章:开发admin管理服务:10:开发【从MongoDB的GridFS中,获取文件,接口】;(从GridFS中,获取文件的SOP)(不使用MongoDB的服务,可以排除其自动加载类)
58:第五章:开发admin管理服务:11:开发【管理员人脸登录,接口】;(未实测)(使用了阿里AI人脸识别)(演示了,使用RestTemplate实现接口调用接口;)
【个人作品】记之-串口日志记录工具
JS数组过滤
Failed to re-init queues : Illegal queue capacity setting (abs-capacity=0.6) > (abs-maximum-capacity
30天刷题计划(五)
GEE(8):使用MODIS填补由去云后的Landsat影像计算得到的NDVI数据