arid_cache 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/arid_cache.gemspec +1 -1
- data/lib/arid_cache/cache_proxy.rb +3 -3
- data/test/arid_cache_test.rb +10 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.7
|
data/arid_cache.gemspec
CHANGED
@@ -47,11 +47,11 @@ module AridCache
|
|
47
47
|
# Fetching results
|
48
48
|
#
|
49
49
|
|
50
|
-
def self.fetch_count(object, key, opts, &block)
|
50
|
+
def self.fetch_count(object, key, opts={}, &block)
|
51
51
|
CacheProxy.new(object, key, opts, &block).fetch_count
|
52
52
|
end
|
53
53
|
|
54
|
-
def self.fetch(object, key, opts, &block)
|
54
|
+
def self.fetch(object, key, opts={}, &block)
|
55
55
|
CacheProxy.new(object, key, opts, &block).fetch
|
56
56
|
end
|
57
57
|
|
@@ -143,7 +143,7 @@ module AridCache
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def get_records
|
146
|
-
block = block || (blueprint && blueprint.proc)
|
146
|
+
block = self.block || (blueprint && blueprint.proc)
|
147
147
|
self.records = block.nil? ? object.instance_eval(key) : object.instance_eval(&block)
|
148
148
|
end
|
149
149
|
|
data/test/arid_cache_test.rb
CHANGED
@@ -328,7 +328,16 @@ class AridCacheTest < ActiveSupport::TestCase
|
|
328
328
|
assert_equal (total/3.0).ceil, page.total_pages
|
329
329
|
end
|
330
330
|
end
|
331
|
-
|
331
|
+
|
332
|
+
test "should support calling store methods directly with a block" do
|
333
|
+
assert_nothing_raised do
|
334
|
+
AridCache.cache.fetch(@user, 'my-fancy-key') do
|
335
|
+
companies
|
336
|
+
end
|
337
|
+
end
|
338
|
+
assert_equal @user.companies.all(:order => 'name DESC'), AridCache.cache.fetch(@user, 'my-fancy-key', :order => 'name DESC') { companies }
|
339
|
+
end
|
340
|
+
|
332
341
|
#
|
333
342
|
# Tests requiring manual verification by looking at the SQL logs.
|
334
343
|
# TODO move these to a separate class.
|