Forum Discussion
Phil_53695
Aug 11, 2011Nimbostratus
Hi All,
I have tried to test this irule but nothing of the items that are listed seem to be getting caches as shown below at
the ltm log
I do have an http profile setup for ram cache turned on.
ltm log:
"Non Caching /app_themes/default/images/icon.check.png"
Based on my irule, shouldn't the *.png be cached?
Below is the script and I suppose I am off somewhat. All I am trying to do is setup a simple RAM cache, add this irule in to see if it's working and then turn off debug. The customers will probably want to see some stats but first I need to ensure it works.
Any one know why?
when HTTP_REQUEST {
set debug 1
switch -glob [string tolower [HTTP::uri]] {
"text/*javascript" -
"scripts/*.js" -
"text/*.css" -
"image/*.swf" -
"image/*.gif" -
"image/*.png" -
"image/*.jpg" -
"image/*.jpeg" {
CACHE::enable
if {$debug} { log local0. "Caching [HTTP::uri]" }
}
default {
CACHE::disable
if {$debug} { log local0. "Non Caching [HTTP::uri]" }
{
HTTP::header replace "Cache-Control" "private, max-age=86400" }
}
}
}
when CACHE_REQUEST { log local0. "[CACHE::hits] cache hits for document at [HTTP::uri]" }