Class: TouchingStore

Inherits:
ActionController::Caching::Fragments::FileStore
  • Object
show all
Defined in:
lib/touching_store.rb

Overview

Will not only read the file but mark it’s modification date. We can then expire “everything that hasn’t b been used for years” to save space

Instance Method Summary collapse

Instance Method Details

#read(name, options = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/touching_store.rb', line 4

def read(name, options = nil)
  begin
    st = Time.now
    File.utime(st, st, real_file_path(name))
    File.open(real_file_path(name), 'rb') { |f| f.read } 
  rescue
    nil
  end
end