Forum Discussion
dan_6764
Nimbostratus
Jul 14, 2009Caching issue
Hi,
I am running version 10.0.0 on my LTM. I wish to be able to flush certain items from my cache dependant on file type/age etc..
I have written the rule below but it doesn't work %100.
Basically it will flush only 1 item at a time..
Eg
I request the page and I cache 2 items on the LTM : 1 gif & 1 jpg
If I wait 10 seconds and request a new page the jpg will flush.
If I wait another 10 seconds and request a new page the gif will flush.
However, if I request the page and wait 25 seconds (passing the cache age rule for both the gif & jpg) only the jpg gets flushed.
when RULE_INIT {
set ::10_secs 10
set ::20_secs 20
set ::one_day 86400
set ::two_hours 7200
set ::one_week 604800
}
when HTTP_REQUEST {
set requested_uri [HTTP::uri]
}
when HTTP_RESPONSE {
if { $requested_uri ends_with ".jpg" } {
} elseif { $requested_uri ends_with ".gif" } {
CACHE::enable
} else
{ CACHE::disable }
}
when CACHE_REQUEST {
if { [CACHE::age] > $::10_secs and $requested_uri ends_with ".jpg"} {
CACHE::expire
log local0. "Expiring content: Age > 10 seconds * jpg"
} elseif { [CACHE::age] > $::20_secs and $requested_uri ends_with ".gif"} {
CACHE::expire
log local0. "Expiring content: Age > 20 seconds * gif"
}
}
Can anybody help??
Thanks
Dan
- dan_6764
Nimbostratus
ok.. think i have cracked it... unless anyone can see something I am missing - Colin_Walker_12Historic F5 AccountThe logic in the CACHE_REQUEST portion in your second rule looks much more sound. Rather than only expiring the first match, it'll expire based on either match.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects