Sep 262013
 

Pour modifier le ttl avec un ratio, il faut ajouter un bout de C :
Au début de la configuration :

C{
        #include <string.h>
        #include <stdlib.h>
        void TIM_format(double t, char *p);
        double TIM_real(void);
}C

Dans le vcl_fetch :

if (beresp.ttl > 0s ) {
        C{
                double obj_ttl = VRT_r_beresp_ttl(sp);
                double ratio = 0.9;
                double new_ttl = obj_ttl*ratio;
                VRT_l_beresp_ttl(sp, new_ttl);
        }C
}

Pour vérifier, vous pouvez ajouter la ligne suivante à la fin du vcl_fetch :

set beresp.http.X-Varnish-TTL = beresp.ttl;

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">

(required)

(required)

Spam protection by WP Captcha-Free