laserlemon-cache_flow 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.
- data/VERSION +1 -1
- data/cache_flow.gemspec +3 -4
- data/lib/cache_flow.rb +6 -4
- metadata +3 -5
- data/.document +0 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/cache_flow.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cache_flow}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["laserlemon"]
|
12
|
-
s.date = %q{2009-08-
|
12
|
+
s.date = %q{2009-08-29}
|
13
13
|
s.description = %q{Easily cache ActiveRecord's to_xml and to_json outputs}
|
14
14
|
s.email = %q{steve@laserlemon.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -17,8 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
|
-
".
|
21
|
-
".gitignore",
|
20
|
+
".gitignore",
|
22
21
|
"LICENSE",
|
23
22
|
"README.rdoc",
|
24
23
|
"Rakefile",
|
data/lib/cache_flow.rb
CHANGED
@@ -47,15 +47,16 @@ module LaserLemon
|
|
47
47
|
def with_cache_flow(extension, options, &block)
|
48
48
|
if options.has_key?(:cache) ? options.delete(:cache) : self.class.cache_serialization
|
49
49
|
options.merge!(:cache => false)
|
50
|
-
key = send("#{extension}_cache_key", options)
|
51
|
-
Rails.cache.fetch(key){
|
50
|
+
key, value = send("#{extension}_cache_key", options), yield
|
51
|
+
Rails.cache.fetch(key){ value.respond_to?(:dup) ? value.dup : value }
|
52
52
|
else
|
53
53
|
yield
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
def xml_cache_key(options)
|
58
|
-
|
58
|
+
level = options.has_key?(:builder) ? options[:builder].instance_eval{ @level } : nil
|
59
|
+
serialized_cache_key(:xml, options.except(:builder).merge(:level => level))
|
59
60
|
end
|
60
61
|
|
61
62
|
def json_cache_key(options)
|
@@ -63,7 +64,8 @@ module LaserLemon
|
|
63
64
|
end
|
64
65
|
|
65
66
|
def serialized_cache_key(extension, options)
|
66
|
-
|
67
|
+
query = options.except(:cache).reject{|k,v| v.nil? }.to_query
|
68
|
+
["#{cache_key}.#{extension}", query].delete_if(&:blank?).join('?')
|
67
69
|
end
|
68
70
|
end
|
69
71
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: laserlemon-cache_flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- laserlemon
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-29 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +32,6 @@ extra_rdoc_files:
|
|
32
32
|
- LICENSE
|
33
33
|
- README.rdoc
|
34
34
|
files:
|
35
|
-
- .document
|
36
35
|
- .gitignore
|
37
36
|
- LICENSE
|
38
37
|
- README.rdoc
|
@@ -45,7 +44,6 @@ files:
|
|
45
44
|
- test/test_helper.rb
|
46
45
|
has_rdoc: false
|
47
46
|
homepage: http://github.com/laserlemon/cache_flow
|
48
|
-
licenses:
|
49
47
|
post_install_message:
|
50
48
|
rdoc_options:
|
51
49
|
- --charset=UTF-8
|
@@ -66,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
64
|
requirements: []
|
67
65
|
|
68
66
|
rubyforge_project:
|
69
|
-
rubygems_version: 1.
|
67
|
+
rubygems_version: 1.2.0
|
70
68
|
signing_key:
|
71
69
|
specification_version: 3
|
72
70
|
summary: Easily cache ActiveRecord's to_xml and to_json outputs
|