Improved child id caching

Fix a bug triggered by calling setPlaceholders multiple times for
children of the same resource but with different sort orders.