code: function(evt) {
          var tile = evt.object;
          if (!this.tileCache[tile.url]) {
              if (!OpenLayers.Element.hasClass(tile.imgDiv, 'olImageLoadError')) {
                  if (this.tileCacheIndex.length >= this.cacheSize) {
                      delete this.tileCache[this.tileCacheIndex[0]];
                      this.tileCacheIndex.shift();
                  }
                  this.tileCache[tile.url] = tile.imgDiv;
                  this.tileCacheIndex.push(tile.url);
              }
          }
      }
docs: Method: addToCache
  
  Parameters:
  evt - {Object} Listener argument for the tile's loadend event