redis-namespace 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of redis-namespace might be problematic. Click here for more details.

Files changed (3) hide show
  1. data/lib/redis/namespace.rb +14 -0
  2. data/spec/redis_spec.rb +65 -0
  3. metadata +5 -5
@@ -48,6 +48,8 @@ class Redis
48
48
  "auth" => [],
49
49
  "bgrewriteaof" => [],
50
50
  "bgsave" => [],
51
+ "bitcount" => [ :first ],
52
+ "bitop" => [ :exclude_first ],
51
53
  "blpop" => [ :exclude_last, :first ],
52
54
  "brpop" => [ :exclude_last ],
53
55
  "brpoplpush" => [ :exclude_last ],
@@ -57,6 +59,8 @@ class Redis
57
59
  "decr" => [ :first ],
58
60
  "decrby" => [ :first ],
59
61
  "del" => [ :all ],
62
+ "discard" => [],
63
+ "dump" => [ :first ],
60
64
  "exists" => [ :first ],
61
65
  "expire" => [ :first ],
62
66
  "expireat" => [ :first ],
@@ -70,6 +74,7 @@ class Redis
70
74
  "hsetnx" => [ :first ],
71
75
  "hget" => [ :first ],
72
76
  "hincrby" => [ :first ],
77
+ "hincrbyfloat" => [ :first ],
73
78
  "hmget" => [ :first ],
74
79
  "hmset" => [ :first ],
75
80
  "hdel" => [ :first ],
@@ -80,6 +85,7 @@ class Redis
80
85
  "hgetall" => [ :first ],
81
86
  "incr" => [ :first ],
82
87
  "incrby" => [ :first ],
88
+ "incrbyfloat" => [ :first ],
83
89
  "info" => [],
84
90
  "keys" => [ :first, :all ],
85
91
  "lastsave" => [],
@@ -101,14 +107,21 @@ class Redis
101
107
  "move" => [ :first ],
102
108
  "mset" => [ :alternate ],
103
109
  "msetnx" => [ :alternate ],
110
+ "object" => [ :exclude_first ],
111
+ "persist" => [ :first ],
112
+ "pexpire" => [ :first ],
113
+ "pexpireat" => [ :first ],
104
114
  "ping" => [],
115
+ "psetex" => [ :first ],
105
116
  "psubscribe" => [ :all ],
117
+ "pttl" => [ :first ],
106
118
  "publish" => [ :first ],
107
119
  "punsubscribe" => [ :all ],
108
120
  "quit" => [],
109
121
  "randomkey" => [],
110
122
  "rename" => [ :all ],
111
123
  "renamenx" => [ :all ],
124
+ "restore" => [ :first ],
112
125
  "rpop" => [ :first ],
113
126
  "rpoplpush" => [ :all ],
114
127
  "rpush" => [ :first ],
@@ -170,6 +183,7 @@ class Redis
170
183
  end
171
184
 
172
185
  attr_accessor :namespace
186
+ attr_reader :redis
173
187
 
174
188
  def initialize(namespace, options = {})
175
189
  @namespace = namespace
@@ -1,6 +1,8 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
3
  describe "redis" do
4
+ @redis_version = Gem::Version.new(Redis.current.info["redis_version"])
5
+
4
6
  before(:all) do
5
7
  # use database 15 for testing so we dont accidentally step on your real data
6
8
  @redis = Redis.new :db => 15
@@ -244,6 +246,69 @@ describe "redis" do
244
246
  @namespaced.respond_to?(:namespace=).should == true
245
247
  end
246
248
 
249
+ if @redis_version >= Gem::Version.new("2.6.0")
250
+ describe "redis 2.6 commands" do
251
+ it "should namespace bitcount" do
252
+ pending "awaiting implementaton of command in redis gem"
253
+ end
254
+
255
+ it "should namespace bitop" do
256
+ pending "awaiting implementaton of command in redis gem"
257
+ end
258
+
259
+ it "should namespace dump" do
260
+ pending "awaiting implementaton of command in redis gem"
261
+ end
262
+
263
+ it "should namespace hincrbyfloat" do
264
+ @namespaced.hset('mykey', 'field', 10.50)
265
+ @namespaced.hincrbyfloat('mykey', 'field', 0.1).should == 10.6
266
+ end
267
+
268
+ it "should namespace incrbyfloat" do
269
+ @namespaced.set('mykey', 10.50)
270
+ @namespaced.incrbyfloat('mykey', 0.1).should == 10.6
271
+ end
272
+
273
+ it "should namespace object" do
274
+ @namespaced.set('foo', 1000)
275
+ @namespaced.object('encoding', 'foo').should == 'int'
276
+ end
277
+
278
+ it "should namespace persist" do
279
+ @namespaced.set('mykey', 'Hello')
280
+ @namespaced.expire('mykey', 60)
281
+ @namespaced.persist('mykey').should == true
282
+ @namespaced.ttl('mykey').should == -1
283
+ end
284
+
285
+ it "should namespace pexpire" do
286
+ @namespaced.set('mykey', 'Hello')
287
+ @namespaced.pexpire('mykey', 60000).should == true
288
+ end
289
+
290
+ it "should namespace pexpireat" do
291
+ @namespaced.set('mykey', 'Hello')
292
+ @namespaced.pexpire('mykey', 1555555555005).should == true
293
+ end
294
+
295
+ it "should namespace psetex" do
296
+ @namespaced.psetex('mykey', 10000, 'Hello').should == 'OK'
297
+ @namespaced.get('mykey').should == 'Hello'
298
+ end
299
+
300
+ it "should namespace pttl" do
301
+ @namespaced.set('mykey', 'Hello')
302
+ @namespaced.expire('mykey', 1)
303
+ @namespaced.pttl('mykey').should == 1000
304
+ end
305
+
306
+ it "should namespace restore" do
307
+ pending "awaiting implementaton of command in redis gem"
308
+ end
309
+ end
310
+ end
311
+
247
312
  # Only test aliasing functionality for Redis clients that support aliases.
248
313
  unless Redis::Namespace::ALIASES.empty?
249
314
  it "should support command aliases (delete)" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-namespace
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Wanstrath
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-05-25 00:00:00 Z
19
+ date: 2012-08-07 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: redis
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  requirements: []
112
112
 
113
113
  rubyforge_project:
114
- rubygems_version: 1.8.21
114
+ rubygems_version: 1.8.24
115
115
  signing_key:
116
116
  specification_version: 3
117
117
  summary: Namespaces Redis commands.