Forum Discussion
lmiestc_26212
Cirrus
Oct 27, 2009iRules and RAM Cache
Hi,
I am new to iRules and I hope somebody can help me. I am using the RAM cache. Everything that can be cached by default is cached for 24 hours in the RAM cache. Now to my problem. I need to cache a response to a query so I created an iRule
when HTTP_REQUEST {
if { [HTTP::path] equals {/mywebpage/public/test/testList.ajax}} {
CACHE::enable
}
}
I think this reads the uri path up until the ? before the query.
The problem is that I need to expire this specific entry in the cache if it is older than two hours and if there is a request for it. While the rest in the cache should remain for 24 hours.
I don't know exactly how to write the iRule for this.
I have seen the below iRule and I think it can be modified.
So the flow should be if there is a HTTP request to where the URI path equals /mywebpage/public/test/testList.ajax and there is a cache hit, check the age if > 7200 if so expire it else send the response from cache to the client.
when CACHE_REQUEST {
if { [CACHE::age] > 7200 } {
CACHE::expire
log local0. "Expiring content: Age > 7200 seconds"
}
}
I'm hoping someone can help me :-)
- hoolio
Cirrostratus
Maybe something like this?when HTTP_REQUEST { set path [HTTP::path] } when CACHE_REQUEST { if { $path equals "/mywebpage/public/test/testList.ajax" && [CACHE::age] > 7200 } { CACHE::expire log local0. "Expiring content: Age > 7200 seconds" } }
- Thanks very much I try that.
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