Skip to content

Ruby example (redis rb)

Josh Baker edited this page Jan 2, 2017 · 3 revisions

redis-rb project page

Install

To install redis-rb, run the following command:

gem install redis

Or if you are using bundler, add

gem 'redis', '~>3.2'

to your Gemfile, and run bundle install

Example

Since tile38 is using the redis commands but not the redis semantics it is advised to use the generic call method to send commands to the tile38 server.

require 'redis'
    
redis = Redis.new(host: 'localhost', port: 9851)
    
redis.call(:set, 'fleet', 'truck1', 'POINT', '33', '-115')
# => 'OK'
    
redis.call(:get, 'fleet', 'truck1')
# => '{"type":"Point","coordinates":[-115,33]}'
Clone this wiki locally