contributions/page.cacheheaders/start.inc.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * @defgroup CacheHeaders 00004 * @ingroup Page 00005 * 00006 * Introduces different cache header policies than the core. 00007 * 00008 * The core default caching headers allow the browser to keep local caches of pages without checking back 00009 * for changes for about 10% of local cache duration time. That is: If a page is stored in local cache for ten 00010 * hours, the browser won't check for the freshness of that page for one hour after fetching it. 00011 * 00012 * This usually is fine, if pages don't change to much. If however your page is highly dynamic, like a forum, 00013 * it's usually better to force the browser to check the freshness of a page on each request. While this 00014 * extends the number of requests, it let's your users see always the latest content. If the content 00015 * has not changed, the browser of course still will get a "304 - Not Modified" response. 00016 * 00017 * @author Gerd Riesselmann 00018 */ 00019 00020 00021 /** 00022 * CacheHeaders config options 00023 * 00024 * Every option can be set through the according APP_ constant, e.g. 00025 * to define cache policy constant APP_CACHEHEADERS_CACHE_POLICY. 00026 * 00027 * @author Gerd Riesselmann 00028 * @ingroup CacheHeaders 00029 */ 00030 class ConfigCacheHeaders { 00031 /** 00032 * Check for rigied freshness, that is force the browser to check a page on each request. 00033 */ 00034 const RIGID_FRESHNESS = 'RIGID'; 00035 00036 /** 00037 * Policy for cached ressources. Cached means locally cached in DB or memory, not browser cached 00038 * 00039 * Allowed values are 00040 * 00041 * - ConfigCacheHeaders::RIGID_FRESHNESS: Browser will be forced to send always send a request. This is the default. 00042 */ 00043 const CACHE_POLICY = 'CACHEHEADER_CACHE_POLICY'; 00044 } 00045 00046 Config::set_value_from_constant( 00047 ConfigCacheHeaders::CACHE_POLICY, 00048 'APP_CACHEHEADER_CACHE_POLICY', 00049 ConfigCacheHeaders::RIGID_FRESHNESS 00050 ); 00051 00052 ViewFactory::set_implementation(new ViewFactoryCacheHeaders());