Forum Discussion
Joseph_Lee_4644
Nimbostratus
Oct 25, 2005Ram Cache
Is it possible to make my Ram Cache "selective" using iRule just like Compression?
11 Replies
- bl0ndie_127134Historic F5 AccountYes there are a few ways of doing this. If you know what resources need to be excluded based on their URI, you can add them to the cache exclude list (no rule required). NOTE: the exclude list accepts regular expressions.
If your exclusion is a little bit more complex, you can use the ‘CACHE::disable’ during the HTTP_REQUEST and HTTP_RESPONSE events to dynamically disable caching. - bl0ndie_127134Historic F5 AccountI think this rule might be what you are looking for.
class images { ".bmp" ".gif" ".jpg" } when HTTP_REQUEST { if { [matchclass [HTTP::uri] ends_with $::images]} { CACHE::enable } else { CACHE::disable } } - Gordon_Johnston
Nimbostratus
I'm new to RAM Cache as well but as I see it from the docs:
>Is it the CACHE::expire will expire all the content in the RAM cache?
CACHE::expire only expires (revalidates) the URI you are working with at the time.
>If I use include list, the others will be exclusive?
No, it will however include URL's that would otherwise have been excluded. "When you add URIs to the include list, the GET methods are cached for the URI and other methods, including non HTTP methods"
>If I use exclude list, the othere will be inclusive?
Again I don't think so, no. It's excludes URIs that would otherwise be cached by default.
>What is the PIN list? I cannot find document on that so far.
According to the help in the web interface:
Pin List: Lists the URIs that the system retains indefinitely in the RAM cache.
BTW there's a PDF about RAM Cache here: http://tech.f5.com/home/bigip-next/solutions/traffic/ramcache.pdf - brad_11480
Nimbostratus
I have static content that i serve from pools other than the default for the virtual server.
While I don't cache from the virtual server itself, I would like to use the RAM Cache for the pages that are being requested from these static content pools.
I tried the command "CACHE::enable" before the "pool static_pool" command, however when applied it did not serve up any images from the static servers.
I would hope it would be possible to ask it to cache (and serve) those pages from RAM Cache, but I'm guessing I just don't understand how to selectively enable it from the iRule.
Any insights would be _greatly_ appreciated. - Rab_101866
Nimbostratus
Hi brad,
did you get an answer to your question.
I want to do something similar, I want to apply caching to one pool but not the other, I have an i rule choosing the pool and the VS does not have caching enabled. Should I enable caching on the VS and disable it for the pool that I don't want caching in?
Thanks.
Rab. - hoolio
Cirrostratus
Hi Rab,
I'd suggest enabling RAM caching on a custom HTTP profile you add to the virtual server and then disable caching in the same iRule when the pool you don't want caching enabled for is selected. You can use the CACHE::disable command to do this:
http://devcentral.f5.com/wiki/default.aspx/iRules/CACHE__enable.html
Aaron - Rab_101866
Nimbostratus
Thanks Aaron that looks like it works.
Is it possible to check if the http profile has caching enabled, if I use CACHE::disable when it is not set in the profile I get an error -
Operation not supported (line 1) invoked from within "CACHE::disable"
I want the same rule to work if http profile has or has not caching enabled.
Thanks.
Rab. - Rab_101866
Nimbostratus
This is what I needed -
if { [PROFILE::http ramcache] equals 1 } {
CACHE::disable
} - hoolio
Cirrostratus
Hi Rab,
I missed your reply. Glad you figured this out.
Aaron - hc_andy_35682
Nimbostratus
Just on this issue of the RAM Cache...if I need to disable caching for an entire domain, is it enough to just add the domain to the URI's Exclude List or do I need to add a wildcard masks to the end of it.
Eg: I want to exclude the following from being cached:
- abc.xyz.com
- abc.xyz.com/blah.jpg
- abc.xyz.com/new/12345
- etc
What to add to the URI Exclude list:
abc.xyz.com <-- is this enough???
abc.xyz.com/* <-- or do I need something like this??
Thanks.
Andy
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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