When you cache a page, rails does not even get asked to execute
anything if the file exists and the server will serve it as a static
If you want to avoid this and have the caching dependent on some logic
in you controller action, you need to use fragment caching.
Action caching may work but I’m not too familiar with it.
There is heaps of information in the docs under caching for the three options.