# Proxy\_cache\_valid, how to get cache valid time by status in source code

**URL:** <https://www.ruby-forum.com/t/proxy-cache-valid-how-to-get-cache-valid-time-by-status-in-source-code/209583>\
**Category:** NGINX\
**Created:** [July 18, 2011, 7:23am UTC](https://www.ruby-forum.com/t/proxy-cache-valid-how-to-get-cache-valid-time-by-status-in-source-code/209583 "2011-07-18T07:23:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [July 18, 2011, 7:23am UTC](https://www.ruby-forum.com/t/proxy-cache-valid-how-to-get-cache-valid-time-by-status-in-source-code/209583/1 "2011-07-18T07:23:38Z")

</div>

hi,  
I have sevral questions about source code.  
1.about the directive proxy\_cache\_valid 200 5m, how does nginx get cache  
valid time by its status? it seems function ngx\_http\_file\_cache\_valid()  
in file ngx\_http\_file\_cache.c isnt used. I’ve checked other functions,  
but nothing found.  
2.now, I need to set cache valid time by extensions, not status. there  
are parameters status\_n, status\_line in u-\>headers\_in,  
(ngx\_http\_upstream\_t \*u), and other parameters in u-\>headers\_in have  
there own fuctions. what am I supposed to do? there’s no parameter for  
me to use in u-\>headers\_in, need I add new parameter in u-\>headers\_in?  
but it’s a complex work.  
I would appreciate if anyone can give a hint.  
Regards.

Posted at Nginx Forum:

> **[proxy\_cache\_valid, how to get cache valid time by status in source code](https://forum.nginx.org/read.php?2,212508,212508#msg-212508)**
>
> hi, I have sevral questions about source code. 1.about the directive proxy\_cache\_valid 200 5m, how does nginx get cache valid time by its status? it seems function ngx\_http\_file\_cache\_valid() in file ngx\_http\_file\_cache.c isnt used. I've checked...
