I'd like to use page caching on the Rails site I run. The data on each page is mainly constant, however the queries that should be go to collect the data are complicated and may be slow in some instances.The only real obstacle to presenting page caching would be that the administrative interface is made in to the primary site to ensure that admin procedures could be carried out without departing the page of great interest.
I am using Apache+mod_rails (Passenger). It is possible to method to indicate to Apache that .html files ought to be overlooked once the current user either includes a session variable or perhaps a cookie named 'admin'*? The session variable do not need to be examined by Apache for validity (since it will likely be examined by Rails within this situation).
It is possible to method to indicate to Apache that .html files ought to be overlooked once the current user either includes a session variable or perhaps a cookie named 'admin'*?
I believe that it is not necessarily possible. Even when it's, I suppose ought to be very tricky.
Rather you should use Action Caching. An estimate from paperwork:
Among the difficulties with page caching is that you simply cannot apply it pages that require checking code to find out if the user ought to be allowed access.
This seems like exactly your situation.
But when you'll still actually need Page Caching via web server, I believe you best implement separate pages for admin and non-admin. This really is due to one good reason. Whenever you enable Page Caching rails does not process the request whatsoever and therefore there's not a way to understand if user is authenticated or otherwise.
Is useful for you but is fairly dirty solution.