smira-memcache-lock 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +2 -3
  2. data/VERSION +1 -1
  3. data/lib/memcache-lock.rb +1 -1
  4. metadata +2 -2
@@ -10,10 +10,9 @@ This is a pure extraction from Nick Kallen's {cache-money}[http://github.com/nka
10
10
 
11
11
  = Usage
12
12
 
13
- Instantiate the lock somewhere, like in an initializer if you're using rails. It needs a MemCache instance.
13
+ Instantiate the lock somewhere, like in an initializer if you're using rails. It will be using Rails.cache by default.
14
14
 
15
- $cache = MemCache.new(YAML.load(File.read("/path/to/memcache/config")))
16
- $lock = MemcacheLock.new($cache)
15
+ $lock = MemcacheLock.new()
17
16
 
18
17
  Then, wherever you'd like to lock a key, use it like this:
19
18
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,7 +5,7 @@ class MemcacheLock
5
5
  DEFAULT_EXPIRY = 30
6
6
 
7
7
  def initialize(cache)
8
- @cache = cache
8
+ @cache = cache || Rails.cache
9
9
  end
10
10
 
11
11
  def synchronize(key, lock_expiry = DEFAULT_EXPIRY, retries = DEFAULT_RETRY)
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andrey Smirnov