class Rack::PageSpeed::Store::Disk
Public Class Methods
new(path = Dir.tmpdir)
click to toggle source
# File lib/rack/pagespeed/store/disk.rb, line 6 def initialize path = Dir.tmpdir raise ArgumentError, "#{path} is not a directory" unless File.directory? path @path = path end
Public Instance Methods
[](key)
click to toggle source
# File lib/rack/pagespeed/store/disk.rb, line 17 def [] key path = "#{@path}/rack-pagespeed-#{key}" File.read path if File.exists? path end
[]=(key, value)
click to toggle source
# File lib/rack/pagespeed/store/disk.rb, line 22 def []= key, value File.open("#{@path}/rack-pagespeed-#{key}", 'w') { |file| file << value } true end
mtime(key)
click to toggle source
Retrieve last modified time from Disk
asset
# File lib/rack/pagespeed/store/disk.rb, line 12 def mtime key path = "#{@path}/rack-pagespeed-#{key}" File.mtime path if File.exists? path end