defunkt-redis 0.2.2 → 0.2.3

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.
data/README.markdown CHANGED
@@ -40,9 +40,8 @@ running first.
40
40
  ## Differences from ezmobius/redis-rb
41
41
 
42
42
  * Connection is deferred until you use the library. a420731
43
- * You may pass `:namespace` to the initializer to scope all keys. 73b9ae3
44
- * You may pass `:thread_safe` to the initializer to make Redis thread
45
- safe. 1d0c44c
43
+ * You may initialize a `Redis::Namespace` class for scoping all keys
44
+ to a namespace
46
45
 
47
46
  I will continue to merge in changes from ezmobius/redis-rb.
48
47
 
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ require 'tasks/redis.tasks'
8
8
 
9
9
  GEM = 'redis'
10
10
  GEM_NAME = 'redis'
11
- GEM_VERSION = '0.1'
11
+ GEM_VERSION = '0.2.3'
12
12
  AUTHORS = ['Ezra Zygmuntowicz', 'Taylor Weibley', 'Matthew Clark', 'Brian McKinney', 'Salvatore Sanfilippo', 'Luca Guidi']
13
13
  EMAIL = "ez@engineyard.com"
14
14
  HOMEPAGE = "http://github.com/ezmobius/redis-rb"
data/lib/redis.rb CHANGED
@@ -108,6 +108,7 @@ class Redis
108
108
  @password = options[:password]
109
109
  @logger = options[:logger]
110
110
  @thread_safe = options[:thread_safe]
111
+ @mutex = Mutex.new if @thread_safe
111
112
 
112
113
  @logger.info { self.to_s } if @logger
113
114
  end
@@ -203,7 +204,7 @@ class Redis
203
204
  end
204
205
 
205
206
  results = if @thread_safe
206
- with_mutex { process_command(command, argvv) }
207
+ @mutex.synchronize { process_command(command, argvv) }
207
208
  else
208
209
  process_command(command, argvv)
209
210
  end
@@ -219,11 +220,6 @@ class Redis
219
220
  end
220
221
  end
221
222
 
222
- def with_mutex(&block)
223
- @mutex ||= Mutex.new
224
- @mutex.synchronize &block
225
- end
226
-
227
223
  def select(*args)
228
224
  raise "SELECT not allowed, use the :db option when creating the object"
229
225
  end
data/spec/redis_spec.rb CHANGED
@@ -18,14 +18,14 @@ describe "redis" do
18
18
  before(:all) do
19
19
  result = RedisRunner.start_detached
20
20
  raise("Could not start redis-server, aborting") unless result
21
-
21
+
22
22
  # yea, this sucks, but it seems like sometimes we try to connect too quickly w/o it
23
- sleep 1
24
-
23
+ sleep 1
24
+
25
25
  # use database 15 for testing so we dont accidentally step on you real data
26
- @r = Redis.new :db => 15
26
+ @r = Redis.new :db => 15
27
27
  end
28
-
28
+
29
29
  before(:each) do
30
30
  @r['foo'] = 'bar'
31
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: defunkt-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezra Zygmuntowicz