Title: tentative patch for browser-cache problem
Last modified: August 22, 2016

---

# tentative patch for browser-cache problem

 *  [apw0225](https://wordpress.org/support/users/apw0225/)
 * (@apw0225)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/tentative-patch-for-browser-cache-problem/)
 * What do you think of the following change to the “Disk-Enhanced” page-caching
   code?
 * In [Generic.php](http://plugins.svn.wordpress.org/w3-total-cache/trunk/lib/W3/Cache/File/Generic.php),
   function **_read()**, in the **return **statement (line 163 in trunk):
 *     ```
       //'time' => null, // BEFORE
       'time' => @filemtime($path), // AFTER
       ```
   
 * Explanation: Currently, the code always returns a null timestamp for cached files.
   With a null time-value, **if the site has “Browser Caching” enabled** with the“
   Last-Modified” option, then the “Last Modified” response header will always be
   set to January 1, 1970 (i.e. the beginning of [Unix time](http://en.wikipedia.org/wiki/Unix_time),
   sometimes seen when evaluating an uninitialized/null date variable). When a user
   revisits the page with this “Last-Modified” value, his browser will usually try
   to send this 1/1/70 date in the “If-Modified-Since” request header, unless he
   does a force-refresh. This value will always match the null-date in <b>_check_modified_since()
   </b> in [PgCache.php](http://plugins.svn.wordpress.org/w3-total-cache/trunk/lib/W3/PgCache.php).
   As a result, a 304 (not modified) response will always be returned, **even if
   the cached file has been updated.**
 * With the above change, the “Last-Modified” header should instead get the cached
   file’s timestamp, which the user’s browser may later send in the “If-Modified-
   Since” header. In response, a 304 will be sent only if the cached file has the
   same timestamp. Otherwise, presumably the cached file has been updated (following
   publish or cache purge), so the new content should be sent instead, with a new
   Last-Modified date.
 * Does this analysis make sense? (Apologies in advance: the poster is not a WordPress
   or W3TC expert, nor has he investigated other possible consequences of this change.)
 * Thanks for your time.
 * [https://wordpress.org/plugins/w3-total-cache/](https://wordpress.org/plugins/w3-total-cache/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [FF_Will](https://wordpress.org/support/users/ff_will/)
 * (@ff_will)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/tentative-patch-for-browser-cache-problem/#post-5837768)
 * Hey APW,
 * I am wondering if you have had success with this at all?
 * I am seeing W3TC returning some 304 on certain pages and looking for a fix.
 * Thanks!
 *  [Kimberly](https://wordpress.org/support/users/amiga500/)
 * (@amiga500)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/tentative-patch-for-browser-cache-problem/#post-5837769)
 * Thanks [@ff_will](https://wordpress.org/support/users/ff_will/) for bumping this
   post…never knew it existed. Interesting OP. My guess is [@apw0225](https://wordpress.org/support/users/apw0225/)
   is long gone 🙁
    I had always been curious about this when i first saw a Last-
   Modified set to 1970. However, never gave it extra thought when i noticed that
   files that originally had it (only happens when the very first time the cache
   file is generated) would adjust themselves (their header) once the file gets 
   updated. For example, all my files show correct Last-Modified, never the 1970
   epoch time. So im not sure if the author fixed the issue upon subsequent file
   writes because i am hesitant to make the change. But i understand the logic.
 * Anyway, if u have Firebug or equivalent (or use an online header analyzer like
   Reddot) check to see if the epoch time is being returned for your 304s consistently.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘tentative patch for browser-cache problem’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [Kimberly](https://wordpress.org/support/users/amiga500/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/tentative-patch-for-browser-cache-problem/#post-5837769)
 * Status: not resolved