Better way of maintaining cache size.