Geo Mashup
[resolved] Is external kml loaded through custom.js cached? (3 posts)

  1. jamesinealing
    Posted 3 years ago #


    I have a dynamic map of all geotagged blog posts onto which I have overlayed geotagged tweets by creating a dynamic kml feed and loading it through custom.js (using the Google v3 example at http://code.google.com/p/wordpress-geo-mashup/wiki/Documentation#JavaScript_API)

    In testing I am having a problem in that when I post new tweets or change the format of the kml the updates are not being reflected on the map. Is the kml data (or in fact the custom.js file) cached somewhere? If so, for how long? That said, I think I've found a way around it by renaming files but it's not ideal.

    Thanks, James


  2. Dylan Kuhn
    Plugin Author

    Posted 3 years ago #

    Google caches KML files, and recommends doing exactly what you've done:


    Geo Mashup doesn't try to cache custom.js - it should be handled the same as other javascript files.

  3. jamesinealing
    Posted 3 years ago #

    Aghhhh, face-palm. Sorry, it's been a year or more since I worked with Google Maps and loading kml!

    I've just implemented a couple of lines in custom.js

    var cachetime = 180;  //desired cache time in seconds
    var param = Math.round(+new Date()/1000/cachetime);

    and then append ?t= + the value of param onto the kml call - I thought I wouldn't overwrite the caching entirely. Seems to work well now.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic