code: function createChunkCache(chunks, capacity)
  {
    var chunkCache;
    var onLoadComplete;
    var index;
    var length;
  
    // create a chunk cache
    chunkCache = new ChunkCache(capacity);
  
    // every time a chunk is loaded, add it to the cache
    // TODO: should the caching be based on most recently 'used' or most recently
    // 'loaded'?
    onLoadComplete = function(err, chunk)
    {
      if (!err)
      {
        chunkCache.put(chunk);
      }
    };
  
    // subscribe to the 'loadcomplete' event on all the chunks
    for (index = 0, length = chunks.length; index < length; index++)
    {
      chunks[index].on('loadcomplete', onLoadComplete);
    }
  
    // TODO: do we need to unsubscribe from the loadcomplete event at some point?
  
    return chunkCache;
  }
docs: TODO
  
  @param chunks
  @param capacity
  
  @returns {ChunkCache}