Multiple storage with multiple backends
Javier Casares
javier at casares.org
Fri Jun 8 08:21:58 CEST 2012
As a sample:
SYSCONFIG:
-s memoria=malloc,128M \
-s disco=file,/var/lib/varnish/storage.bin,512M"
VCL:
if (req.url ~ "\.(7z|bmp|bz2|csv|doc|docx|epub|gif|gz|ico|jpeg|jpg|key|log|mp3|odp|ods|odt|ogg|pdf|png|pps|ppt|pptx|ps|psd|rar|rtf|svg|tar|tbz|tgz|tif|tiff|vcf|xls|xlsx|zip)(\?.*)?$")
{
set beresp.storage = "disco";
} elsif (req.url ~ "\.(css|js|sql|txt|xml)(\?.*)?$") {
if(storage.memoria.free_space > 16MB) {
set beresp.storage = "memoria";
} else {
set beresp.storage = "disco";
}
} else {
if(storage.memoria.free_space > 16MB) {
set beresp.storage = "memoria";
} else {
set beresp.storage = "disco";
}
}
Javier Casares
http://javiercasares.com/
More information about the varnish-misc
mailing list