Skip to content

Commit ac5fbde

Browse files
committed
Bring back Redis::Distributed.
This reverts commit c4ebeda.
1 parent e8317bc commit ac5fbde

40 files changed

+3457
-1299
lines changed

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
* Removed `Redis#[]` and `Redis#[]=` aliases.
66

7-
* Removed `Redis::Distributed`.
8-
97
* Added support for `CLIENT` commands. The lower-level client can be
108
accessed via `Redis#_client`.
119

examples/dist_redis.rb

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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
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+
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'
30+
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')
36+
37+
puts "key distribution:"
38+
39+
r.ring.nodes.each do |node|
40+
p [node.client, node.keys("*")]
41+
end
42+
r.flushdb
43+
p r.keys('*')

0 commit comments

Comments
 (0)