# Serve files from cache only if very sure that it didn't change

**URL:** <https://www.ruby-forum.com/t/serve-files-from-cache-only-if-very-sure-that-it-didnt-change/190233>\
**Category:** NGINX\
**Created:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/serve-files-from-cache-only-if-very-sure-that-it-didnt-change/190233 "2010-06-17T16:22:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dandadude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b5e925/32.png) [@dandadude](https://www.ruby-forum.com/u/dandadude)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/serve-files-from-cache-only-if-very-sure-that-it-didnt-change/190233/1 "2010-06-17T16:22:28Z")

</div>

Hi!

I was wondering (and searching forums, howtos, but didn’t find  
anything):  
Is there a way to tell nginx to only serve static files from cache if  
for instance the timestamp of the file is the same (that probably means  
that the file did not change)?  
This would create an extra overhead of course, but not as much as not  
using cache at all. And with this method I could safely set this to  
sites that are actively developed, since if I use cache the normal way,  
developers will be crying about [http://something.com/someotherthing.jpg](http://something.com/someotherthing.jpg)  
that they upload it and it doesn’t change → I wouldn’t want this.

It is clear that the above requested method would only be good for real  
static content, php and other dynamic content shouldn’t be cached at all  
if I have the above concerns.

Thanks in advance!

Regards,  
Daniel

Posted at Nginx Forum:

> **[serve files from cache only if very sure that it didn't change](https://forum.nginx.org/read.php?2,97693,97693#msg-97693)**
>
> Hi! I was wondering (and searching forums, howtos, but didn't find anything): Is there a way to tell nginx to only serve static files from cache if for instance the timestamp of the file is the same (that probably means that the file did not change)?...
