Jump to content

View a cached page without connecting to PW-database


eydun
 Share

Recommended Posts

  • eydun changed the title to View a cached page without connecting to PW-database

Best would be to use ProCache which does exactly this. You just have to select the template you want cached and update your .htaccess so your server serves the generated page’s HTML.

Edit: note though that the page needs to be visited for it to be cached

  • Like 2
Link to comment
Share on other sites

Thank you for the reply.

I have tried to run a site with ProCache on, and shut down the database-service, and the pages stopped working.

But let me try to test it again. Maybe I did something wrong the first time.

 

Link to comment
Share on other sites

I don't think it's a good idea to shut down the database completely. ProCache will cache pages for a given amount of time and then try to recreate the cache. I don't think that it will be happy about a dead db connection...

Do you want to tell us WHY you want to do that? There's also https://processwire.com/modules/static-wire/ but I've never used it and I don't know if it still works...

  • Like 1
Link to comment
Share on other sites

I agree, normally the database will be running. But I just want to make sure, that if for some reason the database is down (e.g. server reboot/maintenance), then the site will still be up.

Link to comment
Share on other sites

Actually the cached files are cleared if they are expired but only through a LazyCron:

Quote

ProCache runs a maintenance task every 30-60 seconds to remove expired cache files. However, this maintenance is dependent upon the occurrence of non-cached pageviews. Since ProcessWire itself never actually runs when a cached page is displayed, it doesn't have the opportunity to run maintenance tasks. Most sites have some cached pages and some uncached pages, so this is not an issue. However, if most of your site's pages are cached, you should add a cron job to trigger maintenance. Otherwise your cached pages may take longer to expire than intended. Likewise, even if you just want the highest accuracy with regard to when cache files are expired, you might consider a cron job to trigger maintenance.

(from the ProCache’s page)

In other words, if you still have apache running and your database is down, you should not have to worry, so long as your website is fully cached.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...