Question about proxy cache


#1

Hey,

I’m having some problems with proxy_cache. Upstream responds with
Cache-Control and Expires headers set to 30 days. My Nginx is
configured like this:

   proxy_cache_path /var/lib/storage levels=2:2

keys_zone=storage:1024m max_size=102400m;

   # unimportant stuff cut out

   location /storage {
        internal;

        rewrite ^/storage(.*)$ $1 break;

        proxy_method GET;
        proxy_pass_request_headers off;
        proxy_pass_request_body off;

        proxy_pass http://storage;

        proxy_intercept_errors on;

        proxy_cache storage;
        proxy_cache_valid 200 30d;
        proxy_cache_valid any 1h;
    }

I chose random path on my upstream (something like
/repository/data/3e960a013c9f00000000000000004a1bcf4b10f075cf0000) and
I see that Nginx accesses this path very frequently - few times a day.
I thought that the above config would make Nginx access this path only
once a month. The cache is far from being full. What am I doing wrong?

Regards,


#2

2009/6/9 Michał Jaszczyk removed_email_address@domain.invalid:

I thought that the above config would make Nginx access this path only
once a month. The cache is far from being full. What am I doing wrong?

I found something: How exactly does “inactive” argument to
proxy_cache_path work? If inactive is set to, say, 10 minutes and
nobody downloads the file for 10 minutes, is the file deleted from
disk or only from memory?

Regards,