# Nginx\_cache entry evicted ~ 10 min after write despite Cache-Control in the future

**URL:** <https://www.ruby-forum.com/t/nginx-cache-entry-evicted-10-min-after-write-despite-cache-control-in-the-future/241499>\
**Category:** NGINX\
**Created:** [April 10, 2015, 12:33am UTC](https://www.ruby-forum.com/t/nginx-cache-entry-evicted-10-min-after-write-despite-cache-control-in-the-future/241499 "2015-04-10T00:33:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [April 10, 2015, 12:33am UTC](https://www.ruby-forum.com/t/nginx-cache-entry-evicted-10-min-after-write-despite-cache-control-in-the-future/241499/1 "2015-04-10T00:33:50Z")

</div>

Using nginx 1.2.7

Trying to figure out what and why is removing cache entries about 10 min  
after insert (or last read - not yet sure) when the Cache-Control +  
Last-Modified is nearly 24 hours in the future. Are my config / response  
headers to blame or something else?

Ex I would expect the following entry to remain until 22:24:45 Apr 10,  
2015

- yet it disappears from nginx cache dir about 10 min into existence -  
i.e.  
at around 22:35 Apr 9:

[clabs@lb1 cache]$ head 5c395f3ff23eaa0fae58000e5cdbb30a  
8Pyote/1-?&U?@\<  
KEY: /ge/ge.js  
HTTP/1.1 200 OK  
Server: Apache-Coyote/1.1  
Last-Modified: Thu, 09 Apr 2015 22:24:45 GMT  
Cache-Control: max-age=86400, public  
Content-Type: text/javascript;charset=UTF-8  
Content-Language: en-US  
Content-Length: 153734  
Date: Thu, 09 Apr 2015 22:24:45 GMT

…and config:

proxy\_cache\_path /opt/clabs/nginx/tmp/cache keys\_zone=static:1000m;  
server {  
server\_name OMITTED;  
listen 80;

```
      proxy_cache static;
      proxy_cache_key "$uri";

      location / {
        proxy_pass http://search-cluster;
        add_header "X-ECR-Nginx-Cache" $upstream_cache_status;
        add_header "X-ECR-Domain" "static";
      }
    }

```

thanks  
-nikita

Posted at Nginx Forum:

> **[nginx\_cache entry evicted ~ 10 min after write despite Cache-Control in the...](https://forum.nginx.org/read.php?2,257933,257933#msg-257933)**
>
> Using nginx 1.2.7 Trying to figure out what and why is removing cache entries about 10 min after insert (or last read - not yet sure) when the Cache-Control + Last-Modified is nearly 24 hours in the future. Are my config / response headers to blame...

---

<div class="post-metadata">

**Author:** ![nikita.tovstoles](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/3e96dc/32.png) [@nikita.tovstoles](https://www.ruby-forum.com/u/nikita.tovstoles)\
**Post date:** [April 10, 2015, 12:53am UTC](https://www.ruby-forum.com/t/nginx-cache-entry-evicted-10-min-after-write-despite-cache-control-in-the-future/241499/2 "2015-04-10T00:53:50Z")

</div>

On Thu, Apr 09, 2015 at 06:33:12PM -0400, nikita.tovstoles wrote:

Hi there,

> Trying to figure out what and why is removing cache entries about 10 min  
> after insert (or last read - not yet sure) when the Cache-Control +  
> Last-Modified is nearly 24 hours in the future. Are my config / response  
> headers to blame or something else?

> **[Module ngx\_http\_proxy\_module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path)**
>
> The ngx\_http\_proxy\_module module allows passing requests to another server.

> proxy\_cache\_path /opt/clabs/nginx/tmp/cache keys\_zone=static:1000m;

Look for “inactive”.

(That’s my guess, at any rate.)

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![nikita.tovstoles](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/3e96dc/32.png) [@nikita.tovstoles](https://www.ruby-forum.com/u/nikita.tovstoles)\
**Post date:** [April 10, 2015, 12:54am UTC](https://www.ruby-forum.com/t/nginx-cache-entry-evicted-10-min-after-write-despite-cache-control-in-the-future/241499/3 "2015-04-10T00:54:42Z")

</div>

Replying own question - looks like proxy\_cache\_path’s inactive param is  
to  
blame - it defaults to 10 min per docs. Can I disable this param (by  
setting  
inactive=0?) to rely solely on HTTP Response headers?

Posted at Nginx Forum:

> **[Re: nginx\_cache entry evicted ~ 10 min after write despite Cache-Control in...](https://forum.nginx.org/read.php?2,257933,257934#msg-257934)**
>
> Using nginx 1.2.7 Trying to figure out what and why is removing cache entries about 10 min after insert (or last read - not yet sure) when the Cache-Control + Last-Modified is nearly 24 hours in the future. Are my config / response headers to blame...
