Redis 3.2具有geohash类型。
> GEOADD restaurants 32.0 34.0 Falafel
(integer) 1
> GEOADD restaurants 32.1 34.1 Pizza
(integer) 1
GEORADIUS
用于制作地理位置查询:
> GEORADIUS restaurants 32.05 34.05 100 km WITHDIST
1) 1) "Falafel"
2) "7.2230"
2) 1) "Pizza"
2) "7.2213"
但是,HDEL
似乎不起作用:
> HDEL restaurants Falafel
(error) WRONGTYPE Operation against a key holding the wrong kind of value
如何删除或设置TTL到地理哈希中的键?
答案 0 :(得分:2)
Geohashes是排序集,因此right command is ZREM
:
> ZREM restaurants Falafel
(integer) 1
> GEORADIUS restaurants 32.05 34.05 100 km WITHDIST
1) 1) "Pizza"
2) "7.2213"