Caching max item count on layer, and layer index for item