|
"DTD/xhtml1-strict.dtd">
Module Amrita::CacheManager
|
|
cache(filename, typ, source_mtime=nil, key=nil, &block) {|| ...}
|
# File lib/amrita/template.rb, line 12
def cache(filename, typ, source_mtime=nil, key=nil, &block)
source_mtime = Time.new unless source_mtime
item = get_item(typ, filename, key) || Item.new
unless valid_item?(item, source_mtime)
item.filename = filename
item.type = typ
item.key = key
item.mtime = source_mtime
item.contents = yield
save_item(item)
end
item.contents
end
valid_item?(item, source_mtime)
|
# File lib/amrita/template.rb, line 26
def valid_item?(item, source_mtime)
item.mtime && source_mtime && item.mtime >= source_mtime
end
|