class Rack::MiniProfiler::FileStore::FileCache
Public Class Methods
new(path, prefix)
click to toggle source
# File lib/mini_profiler/storage/file_store.rb, line 14 def initialize(path, prefix) @path = path @prefix = prefix end
Public Instance Methods
[](key)
click to toggle source
# File lib/mini_profiler/storage/file_store.rb, line 19 def [](key) begin data = ::File.open(path(key), "rb") { |f| f.read } # rubocop:disable Security/MarshalLoad Marshal.load data # rubocop:enable Security/MarshalLoad rescue nil end end
[]=(key, val)
click to toggle source
# File lib/mini_profiler/storage/file_store.rb, line 30 def []=(key, val) ::File.open(path(key), "wb+") do |f| f.sync = true f.write Marshal.dump(val) end end
Private Instance Methods
path(key)
click to toggle source
# File lib/mini_profiler/storage/file_store.rb, line 39 def path(key) @path.dup << "/" << @prefix << "_" << key.gsub(/:/, '_') end