Internal cache implementation