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?
最佳答案
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"
关于hash - 如何从 redis geohash 中删除一个项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39253946/