Forum Discussion

Drew_123833's avatar
Drew_123833
Icon for Nimbostratus rankNimbostratus
Nov 21, 2014

iRule caching images with Ram cache

Hi folks

I'm trying to write an irule that let me cache an uri or part of my website. The situation now is that everything will be cached. So the thing is that we only want to cache img.mywebsite.com/.... I created this iRule, but it doesn't seems to work. Is there something I need to change or add?

Thx

profile http ImagesCache {

defaults from http
ramcache enable
ramcache size 254mb
ramcache max entries 25000
ramcache max age 86400
ramcache min object size 600
ramcache max object size 50000
ramcache uri include http://img\.mywebsite\.com.*\.jpg
ramcache uri include http://img\.mywebsite\.com/.*\.jpeg
ramcache uri include http://img\.mywebsite\.com/.*\.jpg
ramcache uri include http://img\.mywebsite\.com/.*\.jpeg

}
 when HTTP_HTTP_REQUEST{
   if { [matchclass [HTTP::uri] equals $::cache_uris] } {
    cache:enable
    } else {
    cache:disable
   }
}

4 Replies