mlanett-redis-lock 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8653d5ba9f70e19ce5c3a9339d37bb15004d96b6
4
+ data.tar.gz: dad098554516ff262a63cfc058aa1c810794f6f1
5
+ SHA512:
6
+ metadata.gz: 61eef5bf0f94af47e60fcb80345216207b3d944dc32a8f2bc60e0f02d0273b468b679d3f2507bb6e67a5657848884b57df292bd59d204285a3067cd8dab138c8
7
+ data.tar.gz: 0db86b2e4bfb5b5289d5fb93f30e8e12790aac939b6485ccc769b892327ee0b87bb1ce1bbf448b8a25371f8653550a99501c7280114146ca99eff1a19928fe09
data/README.md CHANGED
@@ -36,23 +36,23 @@ A lock needs an owner. Redis::Lock defaults to using an owner id of HOSTNAME:PID
36
36
  A lock may need more than one attempt to acquire it. Redis::Lock offers an acquisition timeout; this defaults to 10 seconds.
37
37
 
38
38
  There are two lock methods: Redis#lock, which is more convenient, and Redis::Lock#lock.
39
- Notice there are two timeouts: the lock's lifetime (:life option) and the acquisition timeout, which is less important.
39
+ Notice there are two timeouts: the lock's lifetime (```:life``` option) and the acquisition timeout, which is less important.
40
40
  The acquisition timeout is set via the :acquire option to Redis#lock or passed directly to Redis::Lock#lock.
41
41
 
42
42
  ## Usage
43
43
 
44
- This gem adds lock() and unlock() to Redis instances.
45
- lock() takes a block and is safer than using lock() and unlock() separately.
46
- lock() takes a key and lifetime and optionally an acquisition timeout (defaulting to 10 seconds).
44
+ This gem adds `lock()` and `unlock()` to Redis instances.
45
+ `lock()` takes a block and is safer than using `lock()` and `unlock()` separately.
46
+ `lock()` takes a key and lifetime and optionally an acquisition timeout (defaulting to 10 seconds).
47
47
 
48
- redis.lock("test") { |lock| do_something }
48
+ redis.lock("test") { |lock| do_something }
49
49
 
50
- redis.lock("test", life: 2*60, acquire: 2) do |lock|
51
- array.each do |entry|
52
- do_something(entry)
53
- lock.extend_life(60)
54
- end
55
- end
50
+ redis.lock("test", life: 2*60, acquire: 2) do |lock|
51
+ array.each do |entry|
52
+ do_something(entry)
53
+ lock.extend_life(60)
54
+ end
55
+ end
56
56
 
57
57
  ## Goals
58
58
 
data/lib/redis-lock.rb CHANGED
@@ -228,11 +228,11 @@ class Redis
228
228
  # @param options[:acquire] defaults to 10 seconds and can be used to determine how long to wait for a lock.
229
229
  def lock( key, options = {}, &block )
230
230
  acquire = options.delete(:acquire) || 10
231
- Lock.new( self, key, options ).lock( acquire, &block )
231
+ Redis::Lock.new( self, key, options ).lock( acquire, &block )
232
232
  end
233
233
 
234
234
  def unlock( key )
235
- Lock( self, key ).unlock
235
+ Redis::Lock.new( self, key ).unlock
236
236
  end
237
237
 
238
238
  end # Redis
@@ -1,5 +1,5 @@
1
1
  class Redis
2
2
  class Lock
3
- VERSION = "0.2.5"
3
+ VERSION = "0.2.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mlanett-redis-lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
5
- prerelease:
4
+ version: 0.2.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mark Lanett
@@ -13,22 +12,20 @@ authors:
13
12
  autorequire:
14
13
  bindir: bin
15
14
  cert_chain: []
16
- date: 2013-08-25 00:00:00.000000000 Z
15
+ date: 2014-03-27 00:00:00.000000000 Z
17
16
  dependencies:
18
17
  - !ruby/object:Gem::Dependency
19
18
  name: redis
20
19
  requirement: !ruby/object:Gem::Requirement
21
- none: false
22
20
  requirements:
23
- - - ! '>='
21
+ - - ">="
24
22
  - !ruby/object:Gem::Version
25
23
  version: '0'
26
24
  type: :runtime
27
25
  prerelease: false
28
26
  version_requirements: !ruby/object:Gem::Requirement
29
- none: false
30
27
  requirements:
31
- - - ! '>='
28
+ - - ">="
32
29
  - !ruby/object:Gem::Version
33
30
  version: '0'
34
31
  description: Pessimistic locking using Redis
@@ -38,9 +35,9 @@ executables: []
38
35
  extensions: []
39
36
  extra_rdoc_files: []
40
37
  files:
41
- - .gitignore
42
- - .rspec
43
- - .travis.yml
38
+ - ".gitignore"
39
+ - ".rspec"
40
+ - ".travis.yml"
44
41
  - Gemfile
45
42
  - Gemfile-redis2
46
43
  - Gemfile-redis2.lock
@@ -60,33 +57,26 @@ files:
60
57
  - test/stress.rb
61
58
  homepage: ''
62
59
  licenses: []
60
+ metadata: {}
63
61
  post_install_message:
64
62
  rdoc_options: []
65
63
  require_paths:
66
64
  - lib
67
65
  required_ruby_version: !ruby/object:Gem::Requirement
68
- none: false
69
66
  requirements:
70
- - - ! '>='
67
+ - - ">="
71
68
  - !ruby/object:Gem::Version
72
69
  version: '0'
73
- segments:
74
- - 0
75
- hash: -132533030489951021
76
70
  required_rubygems_version: !ruby/object:Gem::Requirement
77
- none: false
78
71
  requirements:
79
- - - ! '>='
72
+ - - ">="
80
73
  - !ruby/object:Gem::Version
81
74
  version: '0'
82
- segments:
83
- - 0
84
- hash: -132533030489951021
85
75
  requirements: []
86
76
  rubyforge_project:
87
- rubygems_version: 1.8.23
77
+ rubygems_version: 2.2.2
88
78
  signing_key:
89
- specification_version: 3
79
+ specification_version: 4
90
80
  summary: Pessimistic locking using Redis
91
81
  test_files:
92
82
  - spec/helper.rb