Welcome! Log In Create A New Profile

Advanced

Re: cache based on file size

Maxim Dounin
August 16, 2013 08:56PM
Hello!

On Mon, Aug 05, 2013 at 10:28:31PM +0000, Johns, Kevin wrote:

> Hi,
>
> In looking over Nginx configuration for the proxy module, I do not see an easy way to influence what is cached based on object size. I have two use cases of interest:
> 1. Store a small file in a particular zone (e.g., SSD), and
>
> 2. Have a large file bypass the cache (no-store large files)
>
> Any insight on how best to accomplish this would be greatly appreciated.

The proxy_no_cache with appropriate variables (e.g., map'ed or
produced with embedded perl from $upstream_http_content_length)
might be usable.

E.g. the following should disable caching of responses larger than
999 bytes or with content length not known:

map $upstream_http_content_length $toolarge {
default 1;
~^\d\d\d$ 0;
}

proxy_no_cache $toolarge;

(Untested.)

See http://nginx.org/r/proxy_no_cache for details.

--
Maxim Dounin
http://nginx.org/en/donation.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

cache based on file size

Johns, Kevin August 05, 2013 06:30PM

Re: cache based on file size

Maxim Dounin August 16, 2013 08:56PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 181
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready