Forum Discussion
Leslie_South_55
Nimbostratus
Jul 26, 2007caching with class
I have defined the following class's in my bigip.conf
class CacheableURI {
"/config/CacheableURI"
}
class CacheableObjects {
"/config/CacheableObjects"
the CacheableURI file contains 2 lines like
"/DIR1/DIR2/Portal/en_US/items.workflow"
"/DIR1/DIR2/Portal/en_US/offers.workflow"
the CacheableObjects file contains these lines
".css"
".gif"
".jpg"
".js"
".png"
and have the following iRule
when HTTP_REQUEST {
set uri [HTTP::uri]
if { [HTTP::version] eq "1.0" } {
log local0. "HTTP::version = [HTTP::version]"
log local0. "diabling cache"
CACHE::disable
return
}
if { [matchclass [HTTP::uri] starts_with $::CacheableURI] and [matchclass [HTTP::uri] ends_with $::CacheableURI] }
{
log local0. "enabling cache for URI: [HTTP::uri]"
CACHE::enable
}
else {
CACHE::disable
log local0. "disabling cache for URI: [HTTP::uri]"
}
}
I am getting some items in cache but others are not caching like I intend them to.
Here is some sample log output
Jul 26 14:23:06 tmm tmm[8636]: Rule rule_cache_disable : disabling cache for URI: /DIR1/DIR2/Portal/en_US/items.workflow:java-configure?x=x&sb=%3A00000025%3A0000005E%3A
Jul 26 14:22:59 tmm tmm[8636]: Rule rule_cache_disable : disabling cache for URI: /Static/images/floater/128.gif
can anyone see why these items are not being cached? and I am also not getting any hits on my
log local0. "enabling cache for URI: [HTTP::uri]"
Thanks
-L
- Leslie_South_55
Nimbostratus
The 2nd matchclass should read - Leslie_South_55
Nimbostratus
Now that I look at it, I am not seeing anything in cache[root@ltm-1:Active] ramcache b profile http profile_test.test.com_http ramcache dump
- Leslie_South_55
Nimbostratus
I have tried to "slim down" the rule to thiswhen HTTP_REQUEST {
- Leslie_South_55
Nimbostratus
Does anyone have any ideas on this? Any help much appreciated. - Leslie_South_55
Nimbostratus
I am trying to match items in the external class files, either of the conditions can apply, so I changed my "and" statement between the "matchclass" statements to "or"...still does not appear to be working. If I remove the "else" statement at the end of the rule, it seems to work, but not all the time on the "CacheableURI" class. - Leslie_South_55
Nimbostratus
Another quick clarification....and forgive me if my question seems simple, but...Caching HAS to be ENABLED in the HTTP profile for this to work..correct? - Wil_Schultz_101
Nimbostratus
Yes. Your error log will confirm this and your site will probably not work.switch -glob [string tolower [HTTP::uri]] { "/uri1*" - "/uri2*" - "/uri3*" { CACHE::disable pool www.my.com_pool } default { pool www.my.com_pool } }
- Leslie_South_55
Nimbostratus
I agree it would be nice to specify the URIs that should not be cached, however in our app, the one's that should be cached consist of 2 URI strings and images, and the one's that should not be cached is everything else. So you can see that identifying the URI's that should not be cached is not possible. - Wil_Schultz_101
Nimbostratus
Yup, that would probably be your best bet.when HTTP_REQUEST { if { !([matchclass [string tolower [HTTP::uri]] contains $::myclass]) } { CACHE::disable pool www.my.com_pool } else { pool www.my.com_pool } }
- Leslie_South_55
Nimbostratus
Finally got it. I realized that I was defining my external classes incorrectly in the bigip.conf, corrected byclass CacheableURI {
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