Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 44 lines (36 sloc) 0.809 kb
4873f49 @djanowski Fix example for Redis::Distributed.
djanowski authored
1 require "redis"
2 require "redis/distributed"
3
4 r = Redis::Distributed.new %w[redis://localhost:6379 redis://localhost:6380 redis://localhost:6381 redis://localhost:6382]
5
6 r.flushdb
c9820ab @qrush Reorganization of gem files and cleaning up.
qrush authored
7
8 r['urmom'] = 'urmom'
9 r['urdad'] = 'urdad'
10 r['urmom1'] = 'urmom1'
11 r['urdad1'] = 'urdad1'
12 r['urmom2'] = 'urmom2'
13 r['urdad2'] = 'urdad2'
14 r['urmom3'] = 'urmom3'
15 r['urdad3'] = 'urdad3'
16 p r['urmom']
17 p r['urdad']
18 p r['urmom1']
19 p r['urdad1']
20 p r['urmom2']
21 p r['urdad2']
22 p r['urmom3']
23 p r['urdad3']
24
4873f49 @djanowski Fix example for Redis::Distributed.
djanowski authored
25 r.rpush 'listor', 'foo1'
26 r.rpush 'listor', 'foo2'
27 r.rpush 'listor', 'foo3'
28 r.rpush 'listor', 'foo4'
29 r.rpush 'listor', 'foo5'
c9820ab @qrush Reorganization of gem files and cleaning up.
qrush authored
30
4873f49 @djanowski Fix example for Redis::Distributed.
djanowski authored
31 p r.rpop('listor')
32 p r.rpop('listor')
33 p r.rpop('listor')
34 p r.rpop('listor')
35 p r.rpop('listor')
c9820ab @qrush Reorganization of gem files and cleaning up.
qrush authored
36
37 puts "key distribution:"
38
4873f49 @djanowski Fix example for Redis::Distributed.
djanowski authored
39 r.ring.nodes.each do |node|
40 p [node.client, node.keys("*")]
c9820ab @qrush Reorganization of gem files and cleaning up.
qrush authored
41 end
4873f49 @djanowski Fix example for Redis::Distributed.
djanowski authored
42 r.flushdb
c9820ab @qrush Reorganization of gem files and cleaning up.
qrush authored
43 p r.keys('*')
Something went wrong with that request. Please try again.