The XYZ layer allows a zoomOffset to be set if you want to have a maximum resolution for the map that differs from the maxiumum resolution of the cached tiles. This example uses only 6 of the levels in the cache, starting with the ninth level (index of 8) in the cache. To do this, the layer is constructed with a zoomOffset of 8. When the map zoom level is zero, the level with index 8 will be requested from the cache.
See the xyz-offset.js source to see how this is done.