class Sprockets::Cache::FileStore


environment.cache = Sprockets::Cache::FileStore.new(“/tmp”)
A simple file system cache store.

def [](key)

Lookup value in cache
def [](key)
  pathname = @root.join(key)
  pathname.exist? ? pathname.open('rb') { |f| Marshal.load(f) } : nil
end

def []=(key, value)

Save value to cache
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