once 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/once.rb +1 -9
- data/lib/once/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dde9027d041ec8bc455dfb29b458fed3666da33e
|
4
|
+
data.tar.gz: 1bb7239b043139e3da69164c09bf9a50ac075aad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a0691f67c45f58704d86663a0a8bff8ae2230a2f0d009babdb6f8adb4ba9879d94dd879ac0565dd4c31fb88a94d48e4fa6285d409cf28c7bd7046bfa9e36378
|
7
|
+
data.tar.gz: 45afe0ac8fbdfc7166330f8263c990ddb358def0174956392345d96d5f2fe2457a1832258d0a2b3d8483c350b41b5568448c7f404862b0698fcf452bab61b809
|
data/CHANGELOG.md
CHANGED
data/lib/once.rb
CHANGED
@@ -37,15 +37,7 @@ module Once
|
|
37
37
|
hash = Digest::MD5.hexdigest(params.inspect)
|
38
38
|
redis_key = "uniquecheck:#{name}:#{hash}"
|
39
39
|
|
40
|
-
|
41
|
-
redis.setex(redis_key, within, true)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
def perform(redis_key, &block)
|
48
|
-
unless redis.exists(redis_key)
|
40
|
+
if redis.set(redis_key, true, ex: within, nx: true)
|
49
41
|
block.call
|
50
42
|
end
|
51
43
|
end
|
data/lib/once/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: once
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yan Pritzker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|