I have been playing with the proxy cache capabilities in Resin 3.1.6
pro lately.  By the description, proxy cache seem incredibly powerful,
but I have confusion implementing the proxy cache in certain cases.

I have two main use cases for the proxy cache.  One appears to works,
and the other doesn't.

The one that appears to work:
I have an image serving php script, that takes an image from the
filesystem, resized it based on a url parameter, and then pipes the
data out for the http request.  The script is called like this:


That last parameter, "50" resizes the image to 50x50 pixels.  This
script allows me to resize images dynamically for my webpages as the
layout dictates, and helps avoid crummy browser resizing from
occurring.  But, as you can imagine, 90% of the time, the same image
size is called and the albumArt.php url is identical.  This seemed
like a prime candidate for proxy caching, even without the url being
dynamic (having ? and & in it).  So I tried it, by adding Expire
headers in my albumArt.php script, and adding this line to my
resin.conf file:

                        <cache-mapping url-pattern="*albumId*size*" 

I also turned on cache logging, and everything seems to work!  I see
the log output "caching /albumArt.php?image=292&size50", soon followed
by a message like
"using cache:   /albumArt.php?image=292&size50"

So far, so good, and I've apparently helped resin avoid doing a file
system read on these images in the case that they reside in proxy
cache memory.

The one that does not work:
So I decided to try the same trick on an rss feed I create via an php
script.  The goal here would be turning a dynamic feed into basically
a static feed, and avoiding making multiple database calls for the
instances where the rss page was returned from a cache hit.  I added
the same Expire headers to the rss.php script, and added a similar
cache-mapping parameter in the resin.conf file:

                        <cache-mapping url-pattern="*rss.php*" 

However, this time resin does not log that the rss.php url is getting
cached.  I'm at a loss for why the proxy cache would work in the
albumArt.php case, but not the rss.php case.  Any ideas?


resin-interest mailing list

Reply via email to