Conditional caching using an iRule
Hi,
I am trying to conditionally disable ramcache from within an iRule, based on an HTTP class, but it is not behaving as I would expect. I am hoping someone here might be able to explain why.
Version is 11.2.1 HF6.
Background: we are trying to use ASM and ramcache on the same virtual server, and are more or less following SOL13112 to cache static content and send the rest to ASM. This procedure seems to have worked for us previously. This time... not so much.
The following iRule somehow causes nothing to be cached, even though the static class is being matched and the
CACHE::disable
is (apparently, verified by the logs) not being reached:-
when HTTP_CLASS_SELECTED {
log local0. "Selected class [HTTP::class] for [HTTP::uri]"
if { not ([HTTP::class] eq "/custname/custname_test_web_http_static") } {
log local0. "Disabling cache for [HTTP::uri] ([HTTP::class])"
CACHE::disable
}
}
The HTTP class uses a regex match identical to the one in that SOL.
If I comment out the
CACHE::disable
, all content gets cached, as I'd expect. However, with the CACHE::disable present, nothing is cached, even for URIs that don't fall into the condition (as verified by the absence of "Disabling cache" logs for those objects.) It feels as though a single call to CACHE::disable
is disabling all caching, not just for the current request.
Can anyone help me understand what I (or the LTM) is doing wrong here?
Many thanks in advance,
Phil.