Nothing will directly happen to the cache lines. In an operating system, we must always assume the worse of the possibilities, and even small caches could face your proposed scenario. However, the operating system does not need to do anything directly to the cache lines, the normal process of paging will handle this scenario.
When the operating system decides to evict a page, it will first write its contents out to disk (as the processor would have marked the page table entry as dirty indicating that the page has been written to). In the process of doing so, the OS will read the values from the entire page including the dirty cache lines, so they will be written back, at least to disk.
Next as part of evicting the page, the operating system will invalidate the translations that map the virtual to physical addresses. Even if the cache lines are still dirty, they can no longer be accessed by the process (i.e., program). After this step, the operating system will write different data into the physical page, and this action will invalidate the cache lines. Finally, the newly repurposed physical page will be mapped to a virtual address.