Warm tip: This article is reproduced from serverfault.com, please click

stackexchange.redis-是否可以在Redis中使用同一成员保存多个GeoEntry或有其他选择?

(stackexchange.redis - Can I save multiple GeoEntry with the same member in Redis or there are alternatives?)

发布于 2020-11-30 15:27:03

我的目的是在Redis(取自OSM)上创建道路速度限制的缓存,在其中搜索纬度和经度的位置,并使用GEORADIUS返回一定半径内的速度限制。

问题是使用:

GEOADD speed-limits -45.000000 10.000000 "90"

如果我添加一个新的头寸,且始终限制为90,则前一个头寸将被覆盖。

Questioner
Alessandro Albi
Viewed
0
lennon310 2020-12-01 03:14:00

你可以

(1)使用复合键作为成员GEOADD speed-limits -45.000000 10.000000 90:timestamp:location,查询将类似于GEORADIUS speed-limits ... WITHCOORD,然后用于.split(":")[0]获取速度。

或者

(2)分开存放速度

GEOADD speed-limits -45.000000 10.000000 timestamp:locationSET timestamp:location 90因此这将是一个两步查询过。