如何从 redis geohash 中删除一个项目?

How to remove an item from a redis geohash?

Redis 3.2 支持 geohash 类型。

GEOADD is used to add keys:

> 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"