redis-namespace 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of redis-namespace might be problematic. Click here for more details.
- data/Rakefile +6 -2
- data/lib/redis/namespace.rb +8 -0
- data/spec/redis_spec.rb +9 -0
- metadata +7 -3
data/Rakefile
CHANGED
@@ -11,12 +11,16 @@ begin
|
|
11
11
|
Jeweler::Tasks.new do |gemspec|
|
12
12
|
gemspec.name = "redis-namespace"
|
13
13
|
gemspec.summary = "Namespaces Redis commands."
|
14
|
-
gemspec.description = "Namespaces Redis commands."
|
15
14
|
gemspec.email = "chris@ozmm.org"
|
16
15
|
gemspec.homepage = "http://github.com/defunkt/redis-namespace"
|
17
16
|
gemspec.authors = ["Chris Wanstrath"]
|
18
|
-
gemspec.version = '0.
|
17
|
+
gemspec.version = '0.4.0'
|
19
18
|
gemspec.add_dependency 'redis'
|
19
|
+
gemspec.description = <<description
|
20
|
+
Adds a Redis::Namespace class which can be used to namespace calls
|
21
|
+
to Redis. This is useful when using a single instance of Redis with
|
22
|
+
multiple, different applications.
|
23
|
+
description
|
20
24
|
end
|
21
25
|
rescue LoadError
|
22
26
|
warn "Jeweler not available. Install it with:"
|
data/lib/redis/namespace.rb
CHANGED
@@ -54,6 +54,14 @@ class Redis
|
|
54
54
|
"flushdb" => [],
|
55
55
|
"get" => [ :first ],
|
56
56
|
"getset" => [ :first ],
|
57
|
+
"hset" => [ :first ],
|
58
|
+
"hget" => [ :first ],
|
59
|
+
"hdel" => [ :first ],
|
60
|
+
"hexists" => [ :first ],
|
61
|
+
"hlen" => [ :first ],
|
62
|
+
"hkeys" => [ :first ],
|
63
|
+
"hvals" => [ :first ],
|
64
|
+
"hgetall" => [ :first ],
|
57
65
|
"incr" => [ :first ],
|
58
66
|
"incrby" => [ :first ],
|
59
67
|
"info" => [],
|
data/spec/redis_spec.rb
CHANGED
@@ -65,6 +65,15 @@ describe "redis" do
|
|
65
65
|
@namespaced.mapped_mget('foo', 'baz', 'bar').should == { 'foo' => '1000', 'bar' => '2000'}
|
66
66
|
end
|
67
67
|
|
68
|
+
it "should be able to use a namespace with hashes" do
|
69
|
+
@namespaced.hset('foo', 'key', 'value')
|
70
|
+
@namespaced.hset('foo', 'key1', 'value1')
|
71
|
+
@namespaced.hget('foo', 'key').should == 'value'
|
72
|
+
@namespaced.hgetall('foo').should == {'key' => 'value', 'key1' => 'value1'}
|
73
|
+
@namespaced.hlen('foo').should == 2
|
74
|
+
@namespaced.hkeys('foo').should == ['key', 'key1']
|
75
|
+
end
|
76
|
+
|
68
77
|
it "should properly intersect three sets" do
|
69
78
|
@namespaced.sadd('foo', 1)
|
70
79
|
@namespaced.sadd('foo', 2)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-namespace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wanstrath
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-29 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,11 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
|
-
description:
|
25
|
+
description: |
|
26
|
+
Adds a Redis::Namespace class which can be used to namespace calls
|
27
|
+
to Redis. This is useful when using a single instance of Redis with
|
28
|
+
multiple, different applications.
|
29
|
+
|
26
30
|
email: chris@ozmm.org
|
27
31
|
executables: []
|
28
32
|
|