How does Prompt Caching work?

Thanks @platypus, but it is very limited and high level documentation, not clear exactly how it works, Is there a way we can see cached tokens to make out to understand how it is working?

It is really unpredictable in the scenarios I listed.