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