Class Amrita::FileCache |
|
Methods |
Public Class methods |
new(dir) |
# File lib/amrita/template.rb, line 531 def initialize(dir) @dir = dir end
Public Instance methods |
get_item(path) |
# File lib/amrita/template.rb, line 535 def get_item(path) path = make_cache_path(path) File::open(path) do |f| item = Item.new item.path = path item.mtime = f.mtime item.template = Marshal::load(f) return item end rescue Errno::ENOENT, Errno::EACCES nil end
save_item(item) |
# File lib/amrita/template.rb, line 548 def save_item(item) path = make_cache_path(item.path) File::open(path, "w") do |f| Marshal::dump(item.template, f) end end