class Rack::MiniProfiler::FileStore::FileCache

Public Class Methods

new(path, prefix) click to toggle source
# File Ruby/lib/mini_profiler/storage/file_store.rb, line 6
def initialize(path, prefix)
  @path = path
  @prefix = prefix
end

Public Instance Methods

[](key) click to toggle source
# File Ruby/lib/mini_profiler/storage/file_store.rb, line 11
def [](key)
  begin
    data = ::File.open(path(key),"rb") {|f| f.read}
    return Marshal.load data
  rescue => e
    return nil
  end
end
[]=(key,val) click to toggle source
# File Ruby/lib/mini_profiler/storage/file_store.rb, line 20
def []=(key,val)
  ::File.open(path(key), "wb+") {|f| f.write Marshal.dump(val)}
end

Private Instance Methods

path(key) click to toggle source
# File Ruby/lib/mini_profiler/storage/file_store.rb, line 25
def path(key)
  @path + "/" + @prefix  + "_" + key
end