build cache lazily