On both my dev machine and live server, I seem to be having a caching issue with the update files that are generated and saved to the /files/livecoverage/ directory.

The files appear to be generated correctly, but when the jQuery calls the file, it seems to be grabbing a cached copy and not the latest version with the latest updates.

Any ideas?

Thanks,
-mike

Comments

kevin hankens’s picture

Do you have any opcode caching? Just a guess. I was hoping to alleviate caching problems by creating .php files for the updates, but that could be inadvertently doing the opposite!

Can you tell me a little bit about your setup? I'd like to nip this one in the bud :)

jonskulski’s picture

Kevin,

This is could be cache by apache. Apache will serve the same content to a user who is requesting the same url.
You can get around this by sending a $_GET query of something that will change, i.e. a timestamp.

url: http://server.com/files/livecontent/test.php will be cached much more aggressively than
http://server.com/files/livecontent/test.php?time=123123355

We gotta talk! I'm finishing up my live update comment module and will be posting a project page later tonight. I'll send you an email with my ideas and maybe we can work on something at druplicon.

ultimike’s picture

I was thinking the same thing as John mentioned in #2 - it's the same reason the .js and .css files in D6 have the ?(random letter) appended to them.

To answer Kevin's question about my setups...

1. I'm not using opcode caching on my dev machine nor my live server.
2. My dev machine is a MacBook Pro running MAMP 1.7.1 (PHP5 and MySql 5)
3. My live server is a pretty standard LAMP setup.

-mike

kevin hankens’s picture

Status: Active » Needs review
StatusFileSize
new1.6 KB

Here's a possible patch. It just adds a PHP header to the update files.

You will have to save a new update to get it to replace any files that are already there.

ultimike’s picture

Kevin,

The "cache-control" patch didn't fix the issue for me, so I went ahead and modified the livecoverage.js file to append a timestamp to the end of the filename to make it unique. This appears to be working for me. The updated javascript function looks like this:

function loadupdates() {
  var timestamp = new Date().getTime();
  uniqueupdatefile = updatefile + '?' + timestamp;
  $.get(uniqueupdatefile, function(txt) {
    $("#entry-list").html(txt)  
  });
}

Short and sweet.

Let me know what you think.

-mike

kevin hankens’s picture

StatusFileSize
new620 bytes

Sweet. That's nice and elegant. I'm probably going to commit it... here's a patch if anyone else has a chance to test.

kevin hankens’s picture

Status: Needs review » Closed (fixed)