Forum Discussion

zafer's avatar
zafer
Icon for Nimbostratus rankNimbostratus
Oct 09, 2008

cache rule for different age and uri

Hello

 

 

here is my code

 

 

when HTTP_REQUEST {

 

if { [ matchclass [HTTP::path] ends_with $::cache_obj] or [ matchclass [HTTP::path] ends_with $::images] } {

 

CACHE::enable

 

log local0. "Caching [HTTP::path]"

 

} else {

 

CACHE::disable

 

log local0. "Non Caching [HTTP::path]"

 

}

 

}

 

 

 

i want cache images 30 days

 

.css 15 minutes

 

.js or url contains get_categories or contains serach.php? 30 minutes

 

i dont want cache all other domains and

 

 

what do i need to change in my config and http profile

 

 

zafer

2 Replies

  • Hi Zafer,

     

     

    You can check the cache wiki page (Click here) for details on the commands. It looks like you can get the age of the cached object using CACHE::age. You can expire a cached object using CACHE::expire. You can view the cached objects from the command line using 'b profile http HTTP_PROFILE_NAME ramcache entry all show'.

     

     

    I ran into a bug on 9.4.5HF2 when explicitly enabling caching in the HTTP_REQUEST event of an iRule. If the request doesn't contain a host header and the request matches the test to explicitly force caching with CACHE::enable, TMM will crash. F5 noted this in CR108998. The workaround is to either check for a host header, or more ideally, let the caching be enabled in the HTTP profile and then selectively disable it when your caching criteria isn't met.

     

     

    Aaron

     

     

  • zafer's avatar
    zafer
    Icon for Nimbostratus rankNimbostratus
    is that possible to help me writing this code, i have no experience cache issues.

     

    i tried some parameters for expire event in irule but i didnt solve my problem

     

     

    zafer