一、发布订阅

1、模型

发布者发布消息,订阅者接收消息

redis发布订阅、HyperLogLog与GEO功能的介绍

 

2、API

2.1、publish

redis发布订阅、HyperLogLog与GEO功能的介绍

2.2、订阅

redis发布订阅、HyperLogLog与GEO功能的介绍

2.3、取消订阅

unsubsribe

redis发布订阅、HyperLogLog与GEO功能的介绍

 

2.4、其他api

redis发布订阅、HyperLogLog与GEO功能的介绍

 

 

二、HyperLogLog

极小空间完成独立数量的统计,本质是字符串类型

redis发布订阅、HyperLogLog与GEO功能的介绍

redis发布订阅、HyperLogLog与GEO功能的介绍

优势:百万数据只占十几k内存

局限:错误率:0.81%,不能取出单条数据 

 

三、GEO

存储经纬度,计算两地距离,范围计算等

 使用场景:距离范围内的酒店、餐馆、摇一摇等

1、geoadd 添加坐标 

redis发布订阅、HyperLogLog与GEO功能的介绍

 

 

 2、geopos   获取地理位置

redis发布订阅、HyperLogLog与GEO功能的介绍

3、geodist

redis发布订阅、HyperLogLog与GEO功能的介绍

 

 

 4、georadius 

redis发布订阅、HyperLogLog与GEO功能的介绍

 

相关文章:

  • 2022-12-23
  • 2021-12-20
  • 2022-01-03
  • 2021-05-05
  • 2021-06-20
  • 2021-07-24
猜你喜欢
  • 2022-02-12
  • 2022-01-29
  • 2021-11-30
  • 2021-06-06
  • 2021-10-13
  • 2021-10-18
  • 2022-01-21
相关资源
相似解决方案