lock_and_cache 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +6 -0
- data/lib/lock_and_cache.rb +6 -4
- data/lib/lock_and_cache/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbcf2cc4c2e6b8f6c7af7eb5226733eb5f9d2180
|
4
|
+
data.tar.gz: ff2b4cf01475da48793e76bf5dccc1b3d437218c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfa83fd496ab5fbd254cf2eab5c497990610af87ec7a013735acbc7c4281961526b592f4312e83251b550dacdccf80f6ea02e368af263fc7077641692e51f294
|
7
|
+
data.tar.gz: 16aaf6d638e1f5b6c1c65cfc4d792a21ce73e5a07c164be22a53194a2f6a955346b449a7e1f4c73fab8fc017e427e15d20d73ae24d7b9593fa0147dc9c33149e
|
data/CHANGELOG
CHANGED
data/lib/lock_and_cache.rb
CHANGED
@@ -122,24 +122,26 @@ module LockAndCache
|
|
122
122
|
key = LockAndCache::Key.new self, method_id, key_parts
|
123
123
|
digest = key.digest
|
124
124
|
storage = LockAndCache.storage
|
125
|
-
Thread.exclusive { $stderr.puts "[lock_and_cache]
|
125
|
+
Thread.exclusive { $stderr.puts "[lock_and_cache] A1 #{key.debug}" } if debug
|
126
126
|
if storage.exists digest
|
127
127
|
return ::Marshal.load(storage.get(digest))
|
128
128
|
end
|
129
|
-
Thread.exclusive { $stderr.puts "[lock_and_cache]
|
129
|
+
Thread.exclusive { $stderr.puts "[lock_and_cache] B1 #{key.debug}" } if debug
|
130
130
|
retval = nil
|
131
131
|
lock_manager = LockAndCache.lock_manager
|
132
132
|
lock_digest = 'lock/' + digest
|
133
133
|
lock_info = nil
|
134
134
|
begin
|
135
135
|
until lock_info = lock_manager.lock(lock_digest, lock_expires)
|
136
|
+
Thread.exclusive { $stderr.puts "[lock_and_cache] C1 #{key.debug}" } if debug
|
136
137
|
sleep lock_spin
|
137
138
|
end
|
138
|
-
Thread.exclusive { $stderr.puts "[lock_and_cache]
|
139
|
+
Thread.exclusive { $stderr.puts "[lock_and_cache] D1 #{key.debug}" } if debug
|
139
140
|
if storage.exists digest
|
141
|
+
Thread.exclusive { $stderr.puts "[lock_and_cache] E1 #{key.debug}" } if debug
|
140
142
|
retval = ::Marshal.load storage.get(digest)
|
141
143
|
else
|
142
|
-
Thread.exclusive { $stderr.puts "[lock_and_cache]
|
144
|
+
Thread.exclusive { $stderr.puts "[lock_and_cache] F1 #{key.debug}" } if debug
|
143
145
|
retval = yield
|
144
146
|
if expires
|
145
147
|
storage.setex digest, expires, ::Marshal.dump(retval)
|