Guest User

Untitled

a guest
Oct 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. require "redis"
  2. require "json"
  3.  
  4. SENTINELS = [{ host: "192.168.99.100", port: 26379 },
  5. { host: "192.168.99.101", port: 26379 },
  6. { host: "192.168.99.102", port: 26379 }]
  7.  
  8. redis = Redis.new(url: "redis://master01/", sentinels: SENTINELS, role: :master)
  9.  
  10.  
  11.  
  12. redis.set "foo", [1, 2, 3].to_json
  13. # => OK
  14.  
  15. JSON.parse(redis.get("foo"))
Add Comment
Please, Sign In to add comment