class Sprockets::Index

def build_asset(path, pathname, options)

Cache asset building in memory and in persisted cache.
def build_asset(path, pathname, options)
  # Memory cache
  key = cache_key_for(pathname, options)
  if @assets.key?(key)
    @assets[key]
  else
    @assets[key] = begin
      # Persisted cache
      cache_asset(key) do
        super
      end
    end
  end
end