class Sprockets::Cache::FileStore
environment.cache = Sprockets::Cache::FileStore.new(“/tmp”)
A simple file system cache store.
def [](key)
def [](key) pathname = @root.join(key) pathname.exist? ? pathname.open('rb') { |f| Marshal.load(f) } : nil end
def []=(key, value)
def []=(key, value) # Ensure directory exists FileUtils.mkdir_p @root.join(key).dirname @root.join(key).open('w') { |f| Marshal.dump(value, f)} value end
def initialize(root)
def initialize(root) @root = Pathname.new(root) end