4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/pack_rat/cache_helper/cacher.rb', line 4
def cache(key='', options={}, &block)
unless options[:overwrite_key] calling_method = caller[0][/`([^']*)'/, 1] key << calling_method << '/'
key << self.cache_key << '/'
if self.is_a? Class
key << self.file_digest
else
key << self.class.file_digest
end
end
puts key if options[:debug] filtered_options = options.except(:debug, :overwrite_key)
Rails.cache.fetch key, filtered_options do
block.call
end
end
|