GEOSEARCHSTORE

Syntax
GEOSEARCHSTORE destination source <FROMMEMBER member |
  FROMLONLAT longitude latitude> <BYRADIUS radius <M | KM | FT | MI>
  | BYBOX width height <M | KM | FT | MI>> [ASC | DESC] [COUNT count
  [ANY]] [STOREDIST]
Available since:
6.2.0
Time complexity:
O(N+log(M)) where N is the number of elements in the grid-aligned bounding box area around the shape provided as the filter and M is the number of items inside the shape
ACL categories:
@write, @geo, @slow,

此命令类似于GEOSEARCH,但将结果存储在目标键中。

此命令替换了现已弃用的GEORADIUSGEORADIUSBYMEMBER

默认情况下,它将结果存储在带有地理空间信息的destination排序集合中。

当使用STOREDIST选项时,该命令将项目存储在一个排序集合中,集合中填充了它们与圆形或矩形中心的距离,作为一个浮点数,单位与为该形状指定的单位相同。

示例

GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania" GEOADD Sicily 12.758489 38.788135 "edge1" 17.241510 38.788135 "edge2" GEOSEARCHSTORE key1 Sicily FROMLONLAT 15 37 BYBOX 400 400 km ASC COUNT 3 GEOSEARCH key1 FROMLONLAT 15 37 BYBOX 400 400 km ASC WITHCOORD WITHDIST WITHHASH GEOSEARCHSTORE key2 Sicily FROMLONLAT 15 37 BYBOX 400 400 km ASC COUNT 3 STOREDIST ZRANGE key2 0 -1 WITHSCORES

RESP2/RESP3 回复

Integer reply: the number of elements in the resulting set

历史

  • 从 Redis 7.0.0 版本开始:增加了对大写单位名称的支持。
RATE THIS PAGE
Back to top ↑