]> git.saurik.com Git - redis.git/blob - client-libraries/ruby/examples/sets.rb
client libraries updated
[redis.git] / client-libraries / ruby / examples / sets.rb
1 require 'rubygems'
2 require 'redis'
3
4 r = Redis.new
5
6 r.delete 'foo-tags'
7 r.delete 'bar-tags'
8
9 puts
10 p "create a set of tags on foo-tags"
11
12 r.set_add 'foo-tags', 'one'
13 r.set_add 'foo-tags', 'two'
14 r.set_add 'foo-tags', 'three'
15
16 puts
17 p "create a set of tags on bar-tags"
18
19 r.set_add 'bar-tags', 'three'
20 r.set_add 'bar-tags', 'four'
21 r.set_add 'bar-tags', 'five'
22
23 puts
24 p 'foo-tags'
25
26 p r.set_members('foo-tags')
27
28 puts
29 p 'bar-tags'
30
31 p r.set_members('bar-tags')
32
33 puts
34 p 'intersection of foo-tags and bar-tags'
35
36 p r.set_intersect('foo-tags', 'bar-tags')