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

标签 hash redis geo redis-3.2

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"

关于hash - 如何从 redis geohash 中删除一个项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39253946/

相关文章:

vb.net - 在 vb.net 中制作 PC 特定哈希

laravel - 如何修复 "Predis\Response\ServerException ERR syntax error"?

algorithm - 使用图形的六边形部分球体表示

mysql - Haversine 公式的不同结果

Android WebView : disable geo: for addresses

algorithm - 从哈希到排列

ruby - 我如何让 Ruby YAML 将 Hash 子类转储为简单的 Hash?

c++ - 是否可以在可移植 C++03 代码中散列指针?

python - 如何在redis-py中指定 ">"

ruby-on-rails - resque-pool 默认为测试环境