3. Small function

Title:
3. Small functions, great use
Catalog:
Redis
Serial number:
3

10) “students”
127.0.0.1:6379>
?? ### GEOshell

Add address location information

127.0 .0.1:6379> geoadd cities:locations 116.28 39.55 beijing
(integer) 1

Add an existing key and return 0

< p>127.0.0.1:6379> geoadd cities:locations 116.28 39.55 beijing
(integer) 0

Add multiple locations at the same time

< p>127.0.0.1:6379> geoadd cities:locations 117.12 39.08 tianjin 114.29 38.02 shijiazhuang
(integer) 2

Get location information

127.0.0.1:6379> geopos cities:locations tianjin
1) 1) “117.12000042200088501”
2) “39.0800000535766543”
127.0.0.1:6379> geopos cities:locations beijing
1) 1 ) “116.28000229597091675”
2) “39.5500007245470826”

Get the distance between two locations

m-meter, km-km, mi-mile, ft-foot

127.0.0.1:6379> geodist cities:locations tianjin beijing km
“89.2061 “

Get the location set within the execution location Address information location collection

127.0.0.1:6379> georadiusbymember cities:location beijing 500 km
(empty list or set)
127.0.0.1:6379> georadiusbymember cities:location beijing 5000 km< br> (empty list or set)
127.0.0.1:6379> geohash cities:bejing
(empty list or set)
127.0.0.1:6379> geohash cities:beijing
(empty list or set)
127.0.0.1:6379> geohash cities:tianjin
(empty list or set)

Get geohash

127.0.0.1: 6379> geohash cities:locations tianjin
1) “wwgq34k1tb0”
127.0.0.1:6379> zrem key cities:locations tianjin
(integer) 0

Delete address location information

127.0.0.1:6379> zrem cities:locations tianjin
(integer) 1
127.0.0.1:6379>
?
“`

https://www.runoob.com/redis/redis-hyperloglog.html

Leave a Comment

Your email address will not be published.