Image Caching

Kyle Mulka kmulka at GLC.ORG
Thu Aug 4 07:30:01 PDT 2005


Would it be good to move this discussion to mapserver-dev?

> By the looks of what i have seen in your demo you do a great job already.
:-)

I'm using the PEAR Cache_Lite package for PHP right now. Its simple to use.
Only takes about 10 lines of code.

> Probably this will rather be some reliable and tested squid proxy set-up
or any 
> kind of front end behind which MapServer can hide. 

I looked into squid and realized that thing it needs to know is when the
content changes so that it can refresh the cache. From what I've heard so
far, it doesn't sound like mapserver has any clue as to when the map it
serves might change. It seems that it would be pretty easy for mapserver to
simply determine if a map would change based on the timestamp on the
shapefiles its serving and either the timestamp or the content of the map
file.

I'm not sure as to the exact details of how it would report this to the
caching engine (squid for example), but I think it has something to do with
the http headers it would return when the headers were requested.


> Cool demos, would you share the architecture on how you implemented
caching in > this installation?

Like I said above, I use the PEAR Cache_Lite package. 
http://pear.php.net/package/Cache_Lite

I used a cache lifetime of about a week, although I could have used longer.
I'll need to manually delete the cache when I change the colors, style,
content, etc. The cache id I used was the full request URL to the WMS
service. So, everything after the question mark basically. Each query should
not change its result as long as I don't change the map file or shapefiles.

> In some environments (preferrably very large networks) you do not have to
worry 
> at all about caching because its been done by the network anyway. That is
when 
> we start to develop a problem the other way round - how to tell the
caching >>
> service to request for a new tile because the content has changed on the >
> server...

Exactly. This is why we need at least something in mapserver that knows
about caching. Mapserver doesn't actually have to do the caching, but should
know when caching would be appropriate.

-Kyle Mulka
http://www.kylemulka.com



More information about the MapServer-users mailing list