Where to store a system flag?
<p>This may seem a silly question, but having been pondering it for a few days, i've only come up with one answer, so I thought i'd throw it open and see what other people think.</p>

<p>I have a PHP script which runs as a CRON job, and checks that our CDN is up and running.  If it is, it needs to set a flag to show 'true', if not to show 'false'.  The main PHP webpages then need to check this flag everytime a user visits the site, and set the CDN URL variable appropriately.</p>

<p>The query is where do we store this flag?  We could put it in a database, but then the database would get 'hit' every page load.  Also, as we're using Memcache it could result in a delay to it being updated (although there are ways around that, obviously).</p>

<p>My next thought was to save it into a simple text file on the server.  But a) we have load-balanced servers, and although we could run the same CRON job on each server, that seems inefficient, and b) opening and reading a text file could, i thought, slow the page load down, as its involving disk activity everytime - that isn't good when the system is delivering 3 million web pages a week!</p>

<p>The ideal would be PHP system variable that retains its value between pages - but of course, that doesn't exist!  Its not the kind of information that should be stored as a cookie on the users machine either.</p>

<p>Does any one have any thoughts?  All comments welcome!</p>
