SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot theslip's Avatar
    Join Date
    Jun 2008
    Location
    here
    Posts
    122
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Updating PDFs - is cache an issue? please help

    Updating PDFs - is cache an issue? please help

    Hi there can anyone tell me, when updating a pdf on a website, should I rename it everytime due to cache, as I dont want people seeing the old PDF.

    When updating webpage content I dont rename the page, when updating images I do rename the image due to cache issue.

    What should do with PDF files, its nice and easy to just replace with the same name? any issues with this do you think guys?

    Can anyone help with this one please, please, please?

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Wht do you distinguish between web pages and images? The browser cache expires everything after the same amount of time so there is no point distinguishing different file types.

    The best way to control it is in the headers you pass with the PDF file - then you can have it download new every time without ever re reading the cached copy - if you really want to do that.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Old trick--use the same filename, and change the query string. This won't break stuff like google results, keeps you from having multiple versions of files on a public server while also ensuring users get a new version if they've got a cached copy. Also, you don't need to do anything server-side to push headers with said PDF.

  4. #4
    SitePoint Wizard
    Join Date
    Apr 2002
    Posts
    2,322
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    as felgall says, headers are where the cache control is at. maybe use something like firefox's http live headers plug in to see what cache control your pdf file has. that's what'll say/control if your pdf should be cached or not, for how long.

    also as felfall hints at, i don't think different file types necessarily come into it (unless you or someone else has set cache controls based on file types, which is possible with apache's gubbins).

    there's different strategies. to get the most out of caching from the user's point of view it seems setting cache to as good as infinity on files (other than page files: php/html ones) then changing names when they change.

    use a header viewer to see what cache your pdf has


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •