Module: Valkey::Commands::GeoCommands
- Included in:
- Valkey::Commands
- Defined in:
- lib/valkey/commands/geo_commands.rb
Overview
This module contains commands on geospatial operations.
Instance Method Summary collapse
-
#geoadd(key, *members) ⇒ Integer
Add one or more geospatial items (longitude, latitude, name) to a key.
-
#geodist(key, member1, member2, unit = 'm') ⇒ String?
Returns the distance between two members of a geospatial index.
-
#geohash(key, *member) ⇒ Array<String, nil>
Returns geohash string representing position for specified members of the specified key.
-
#geopos(key, *members) ⇒ Array<Array<Float, Float>, nil>
Retrieve the positions (longitude, latitude) of one or more elements.
-
#geosearch(*args) ⇒ Array
Perform raw GEOSEARCH command with direct arguments like Redis.
-
#geosearchstore(destination, source, *args) ⇒ Integer
Store the result of a GEOSEARCH query into a new sorted set key.
Instance Method Details
#geoadd(key, *members) ⇒ Integer
Add one or more geospatial items (longitude, latitude, name) to a key.
19 20 21 |
# File 'lib/valkey/commands/geo_commands.rb', line 19 def geoadd(key, *members) send_command(RequestType::GEO_ADD, [key, *members]) end |
#geodist(key, member1, member2, unit = 'm') ⇒ String?
Returns the distance between two members of a geospatial index
51 52 53 |
# File 'lib/valkey/commands/geo_commands.rb', line 51 def geodist(key, member1, member2, unit = 'm') send_command(RequestType::GEO_DIST, [key, member1, member2, unit]) end |
#geohash(key, *member) ⇒ Array<String, nil>
Returns geohash string representing position for specified members of the specified key.
41 42 43 |
# File 'lib/valkey/commands/geo_commands.rb', line 41 def geohash(key, *member) send_command(RequestType::GEO_HASH, [key, *member]) end |
#geopos(key, *members) ⇒ Array<Array<Float, Float>, nil>
Retrieve the positions (longitude, latitude) of one or more elements.
32 33 34 |
# File 'lib/valkey/commands/geo_commands.rb', line 32 def geopos(key, *members) send_command(RequestType::GEO_POS, [key, *members]) end |
#geosearch(*args) ⇒ Array
Perform raw GEOSEARCH command with direct arguments like Redis
62 63 64 |
# File 'lib/valkey/commands/geo_commands.rb', line 62 def geosearch(*args) send_command(RequestType::GEO_SEARCH, args) end |
#geosearchstore(destination, source, *args) ⇒ Integer
Store the result of a GEOSEARCH query into a new sorted set key.
82 83 84 |
# File 'lib/valkey/commands/geo_commands.rb', line 82 def geosearchstore(destination, source, *args) send_command(RequestType::GEO_SEARCH_STORE, [destination, source, *args]) end |