def fetch_asset_from_dependency_cache(unloaded, limit = 3)
        key = unloaded.dependency_history_key

        history = cache.get(key) || []
        history.each_with_index do |deps, index|
          expanded_deps = deps.map do |path|
            path.start_with?("file-digest://") ? expand_from_root(path) : path
          end
          if asset = yield(expanded_deps)
            cache.set(key, history.rotate!(index)) if index > 0
            return asset
          end
        end

        asset = yield
        deps  = asset[:metadata][:dependencies].dup.map! do |uri|
          uri.start_with?("file-digest://") ? compress_from_root(uri) : uri
        end
        cache.set(key, history.unshift(deps).take(limit))
        asset
      end
def fetch_asset_from_dependency_cache(unloaded, limit = 3)
        key = unloaded.dependency_history_key

        history = cache.get(key) || []
        history.each_with_index do |deps, index|
          expanded_deps = deps.map do |path|
            path.start_with?("file-digest://") ? expand_from_root(path) : path
          end
          if asset = yield(expanded_deps)
            cache.set(key, history.rotate!(index)) if index > 0
            return asset
          end
        end

        asset = yield
        deps  = asset[:metadata][:dependencies].dup.map! do |uri|
          uri.start_with?("file-digest://") ? compress_from_root(uri) : uri
        end
        cache.set(key, history.unshift(deps).take(limit))
        asset
      end
Internal: Retrieves an asset based on its digest

 unloaded - An UnloadedAsset
 limit    - A Fixnum which sets the maximum number of versions of "histories"
            stored in the cache

 This method attempts to retrieve the last `limit` number of histories of an asset
 from the cache a "history" which is an array of unresolved "dependencies" that the asset needs
 to compile. In this case a dependency can refer to either an asset e.g. index.js
 may rely on jquery.js (so jquery.js is a dependency), or other factors that may affect
 compilation, such as the VERSION of Sprockets (i.e. the environment) and what "processors"
 are used.

 For example a history array may look something like this

   [["environment-version", "environment-paths", "processors:type=text/css&file_type=text/css",
     "file-digest:///Full/path/app/assets/stylesheets/application.css",
     "processors:type=text/css&file_digesttype=text/css&pipeline=self",
     "file-digest:///Full/path/app/assets/stylesheets"]]

 Where the first entry is a Set of dependencies for last generated version of that asset.
 Multiple versions are stored since Sprockets keeps the last `limit` number of assets
 generated present in the system.

 If a "history" of dependencies is present in the cache, each version of "history" will be
 yielded to the passed block which is responsible for loading the asset. If found, the existing
 history will be saved with the dependency that found a valid asset moved to the front.

 If no history is present, or if none of the histories could be resolved to a valid asset then,
 the block is yielded to and expected to return a valid asset.
 When this happens the dependencies for the returned asset are added to the "history", and older
 entries are removed if the "history" is above `limit`.