Concrete MetaStore implementation that stores request/response pairs on disk.
# File lib/rack/cache/metastore.rb, line 235 def purge(key) path = key_path(key) File.unlink(path) nil rescue Errno::ENOENT, IOError nil end
# File lib/rack/cache/metastore.rb, line 217 def read(key) path = key_path(key) File.open(path, 'rb') { |io| Marshal.load(io) } rescue Errno::ENOENT, IOError [] end
# File lib/rack/cache/metastore.rb, line 224 def write(key, entries) tries = 0 begin path = key_path(key) File.open(path, 'wb') { |io| Marshal.dump(entries, io, -1) } rescue Errno::ENOENT, IOError Dir.mkdir(File.dirname(path), 0755) retry if (tries += 1) == 1 end end
Generated with the Darkfish Rdoc Generator 2.