cache_mock 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cache_mock.rb +0 -2
- data/lib/cache_mock/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f4a5c3de58347f81ab7f4452fbbc865b0015fffaa08f49e13a18e722e592ef5a
|
|
4
|
+
data.tar.gz: f3cc84e87042deb7e21e22c27300a71b4fd61c21ff9341a9aa095675a1eba19b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0bbabec7a5fa875ee083ace38859ecb6eb4899b56176e24c1ceedb875e176f2c639e78faa2dce00a48d116cf3320f85fa1012faddaaf4b2aa765234d41f2c8d9
|
|
7
|
+
data.tar.gz: 876e14480c79f2eb07f62f9f46639edd4be949b2e654278593b251cbf3a83a2172075f68d51fb7ddc242726894006b0fcd76f97aa657b71431c382f4c809dba8
|
data/Gemfile.lock
CHANGED
data/lib/cache_mock.rb
CHANGED
|
@@ -10,12 +10,10 @@ class CacheMock
|
|
|
10
10
|
|
|
11
11
|
if exist?(key)
|
|
12
12
|
# fetch and return result
|
|
13
|
-
puts "fetch from cache and will expire in #{db[key][:expiration_time] - Time.now.to_i}"
|
|
14
13
|
db[key][:value]
|
|
15
14
|
else
|
|
16
15
|
if block_given?
|
|
17
16
|
# make the DB query and create a new entry for the request result
|
|
18
|
-
puts "did not find key in cache, executing block ..."
|
|
19
17
|
db[key] = build_record(options, &block)
|
|
20
18
|
db[key][:value]
|
|
21
19
|
else
|
data/lib/cache_mock/version.rb
CHANGED