ngmoco-cache-money 0.2.20 → 0.2.21
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/lib/cache_money.rb +1 -1
- data/lib/cash/query/abstract.rb +1 -1
- metadata +4 -5
- data/lib/cash/relation/cached_finder_methods.rb +0 -31
data/lib/cache_money.rb
CHANGED
data/lib/cash/query/abstract.rb
CHANGED
@@ -61,7 +61,7 @@ module Cash
|
|
61
61
|
|
62
62
|
private
|
63
63
|
def cacheable?(*optionss)
|
64
|
-
return false if @active_record.respond_to?(:
|
64
|
+
return false if @active_record.respond_to?(:cacheable?) && ! @active_record.cacheable?(*optionss)
|
65
65
|
optionss.each { |options| return unless safe_options_for_cache?(options) }
|
66
66
|
partial_indices = optionss.collect { |options| attribute_value_pairs_for_conditions(options[:conditions]) }
|
67
67
|
return if partial_indices.include?(nil)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ngmoco-cache-money
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 61
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 21
|
10
|
+
version: 0.2.21
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nick Kallen
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2010-10-
|
21
|
+
date: 2010-10-05 00:00:00 -07:00
|
22
22
|
default_executable:
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
@@ -83,7 +83,6 @@ files:
|
|
83
83
|
- lib/cash/query/calculation.rb
|
84
84
|
- lib/cash/query/primary_key.rb
|
85
85
|
- lib/cash/query/select.rb
|
86
|
-
- lib/cash/relation/cached_finder_methods.rb
|
87
86
|
- lib/cash/request.rb
|
88
87
|
- lib/cash/transactional.rb
|
89
88
|
- lib/cash/util/array.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module Cash
|
2
|
-
module Relation
|
3
|
-
module CachedFinderMethods
|
4
|
-
def find_one_with_cache(id)
|
5
|
-
return find_one_without_cache unless is_cached
|
6
|
-
|
7
|
-
id = id.id if ActiveRecord::Base === id
|
8
|
-
|
9
|
-
cache_miss = false
|
10
|
-
result = @klass.get(id) do
|
11
|
-
cache_miss = true
|
12
|
-
find_one_without_cache(id)
|
13
|
-
end
|
14
|
-
@klass.set(id, result) if cache_miss && result
|
15
|
-
end
|
16
|
-
|
17
|
-
def find_some_with_cache(ids)
|
18
|
-
return find_some_without_cache unless is_cached
|
19
|
-
|
20
|
-
cache_miss = false
|
21
|
-
result = @klass.get(ids) do
|
22
|
-
cache_miss = true
|
23
|
-
find_some_without_cache(ids)
|
24
|
-
end
|
25
|
-
if cache_miss && result
|
26
|
-
result.each {|r| @klass.set(r.id, r) if r} if result.is_a?(Array)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|