How does prompt caching work with files

How does prompt caching work with documents?

I want to use gpt5 over the api with CSV documents. I have 3 different csv documents that get updated in different times.

The first one gets updated every week, the second one every day and the last one every 15minutes. But for each of them the updates are append only.

So from what I understand I should first attach the file that gets updated weekly, then the file that gets updated daily and lastly the file that gets updated every 15mins, so that I use the prompt caching as best as possible, right?

Is my understanding correct, and does prompt caching even work for CSV Files? I am pretty new to using API so sorry if this is a dumb question.

The context window cache is mere minutes of persistence. It is the actual API call that creates a temporary cache, and then you start getting a discount only if there is a starting part that is identical for over 1024 tokens, more practically 1280 tokens where it is actually delivered.

So yes, you’d want to ensure the longest length from the start is identical between calls.

Having the file that is changing as the most recent context, even individual messages where the message content creation method never changes, would be best practice, just in case you have a conversation that could be cached that has a follow-up turn that crosses the time threshold of an automatic file change and resets the cache discount delivery back to where the unchanging content is.

A csv should be just bytes of data. There are some files that will start with a header or metadata that changes when the content changes, but not csv if you aren’t sorting or changing the initial data yourself.