3

这个 GEO 场景是用 Lua 还是 redisTemplate?

 2 years ago
source link: https://www.v2ex.com/t/810906
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  程序员

这个 GEO 场景是用 Lua 还是 redisTemplate?

  breadykidliu · 15 小时 51 分钟前 · 559 次点击

用 redis 的 geo 要怎么做?目前已经用 boundGeoOps 存储所有门店名的坐标了
需求,数据有全球的国家 /市 /门店 /坐标,需要根据给定的坐标将门店坐标以及在给定的 key 集合中由近及远排序,并 groupBy 市再 groupBy 国家,市和国家的排序按照其下面列表的第一个门店坐标的距离来排序,这个怎么实现? 结果集类似于如下结构:给定某个坐标

国家 A(门店 A 坐标)
|___城市 A(门店 A 坐标)
    |___门店 A 信息(近)
    	门店 B 信息(远)
        ...
国家 B(门店 C 坐标)
|___城市 B(门店 C 坐标)
    |___门店 C 信息(近)
    	门店 D 信息(远)
        ...
...

看了 georadius 和 georadiusbymember 都是需要设置距离范围的,这里不能设范围的限制,因为是全球范围的门店


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK