Changeset 17887

Show
Ignore:
Timestamp:
10/03/08 12:09:56 (2 months ago)
Author:
rambo
Message:

added some important notes about caching and made flushing of output to happen before we start writing the cache files so user does not have to wait for the writes to complete

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/midcom.core/midcom/services/cache/module/content.php

    r17501 r17887  
    955955 
    956956        $cache_data = ob_get_contents(); 
     957        /** 
     958         * WARNING:  
     959         *   From here on anything added to content is not included in cached 
     960         *   data, so make sure nothing content-wise is added after this  
     961         */ 
    957962 
    958963        // Generate E-Tag header. 
     
    975980        $this->register_sent_header($header); 
    976981        $this->_complete_sent_headers($cache_data); 
     982 
     983        // If-Modified-Since / If-None-Match checks, if no match, flush the output. 
     984        if (! $this->_check_not_modified($this->_last_modified, $etag)) 
     985        { 
     986            ob_end_flush(); 
     987            $this->_obrunning = false; 
     988        } 
     989 
     990        /** 
     991         * WARNING:  
     992         *   Stuff below here is executed *after* we have flushed output, 
     993         *   so here we should only write out our caches but do nothing else 
     994         */ 
    977995 
    978996        if ($this->_uncached) 
     
    9911009            $this->write_meta_cache($content_id, $etag); 
    9921010            $this->_data_cache->put($content_id, $cache_data); 
    993         } 
    994  
    995         // Finish caching. 
    996         // If-Modified-Since / If-None-Match checks, if no match, flush the output. 
    997         if (! $this->_check_not_modified($this->_last_modified, $etag)) 
    998         { 
    999             ob_end_flush(); 
    1000             $this->_obrunning = false; 
    10011011        } 
    10021012    }