fc2 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/fc2.rb +3 -2
- data/lib/fc2/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: 5be86c57f3df20b9bae13d9959a89cc821f369c8
|
4
|
+
data.tar.gz: 2d3d29e7bc7da4ca0f8e96c3acd60c6cf2fa5fba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37394972d6a88044ab537263d5f8da338ccc370deb1fd6dda368604033ce9482fb7ed5357dfefd9287905c6c786c9c17e1a079bd3a4cabbc2fd816afb500bf0e
|
7
|
+
data.tar.gz: b39a6952cd003c733a29e236a72e176d01ad48e95ea309e2bccf74a16676c28a17920c8558eba4fa109cf877ba082d7d73858e374b1d42964523feb589b37167
|
data/README.md
CHANGED
data/lib/fc2.rb
CHANGED
@@ -12,7 +12,7 @@ module Fc2
|
|
12
12
|
def use_cache(method_name)
|
13
13
|
prepend(Module.new do
|
14
14
|
define_method(method_name) do |*args, &block|
|
15
|
-
Fc2.fetch do
|
15
|
+
Fc2.fetch(key: "#{self.class}\##{__method__}") do
|
16
16
|
super(*args, &block)
|
17
17
|
end
|
18
18
|
end
|
@@ -20,7 +20,8 @@ module Fc2
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def self.fetch(key:
|
23
|
+
def self.fetch(key: caller.first, expires_in: 300)
|
24
|
+
key = Digest::MD5.hexdigest(key)
|
24
25
|
path = File.expand_path(key, cache_dir)
|
25
26
|
return Marshal.load(File.read(path)) if use_cache?(path, expires_in)
|
26
27
|
dump(path, yield)
|
data/lib/fc2/version.rb
CHANGED