Opened 7 years ago
Last modified 7 years ago
#1505 new enhancement
Milliseconds and dynamic time support for *_cache_valid
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | other | Version: | 1.12.x |
Keywords: | Cc: | ||
uname -a: | FreeBSD 11.1-RELEASE-p4 | ||
nginx -V: |
nginx version: nginx/1.12.2
built with OpenSSL 1.0.2k-freebsd 26 Jan 2017 TLS SNI support enabled configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --user=www --group=www --modules-path=/usr/local/libexec/nginx --with-file-aio --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-scgi-temp-path=/var/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-log-path=/var/log/nginx/access.log --with-http_addition_module --with-http_auth_request_module --add-dynamic-module=/wrkdirs/usr/ports/www/nginx/work/headers-more-nginx-module-84241e4 --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --with-http_gunzip_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_stub_status_module --with-http_sub_module --add-module=/wrkdirs/usr/ports/www/nginx/work/ngx_devel_kit-0.3.0 --add-dynamic-module=/wrkdirs/usr/ports/www/nginx/work/lua-nginx-module-0.10.8 --with-pcre --add-dynamic-module=/wrkdirs/usr/ports/www/nginx/work/passenger-5.1.11/src/nginx_module --with-http_v2_module --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-mail=dynamic --with-mail_ssl_module --with-http_ssl_module |
Description
Hello,
At this moment cache doesn't work with milliseconds like:
proxy_cache_valid 200 200ms;
nginx: [emerg] invalid time value "200ms"
Useful will be also to set time via variable:
set $valid_time "200ms";
proxy_cache_valid 200 $valid_time;
Any chance for it? :)
Change History (2)
comment:1 by , 7 years ago
Type: | defect → enhancement |
---|
comment:2 by , 7 years ago
We have one big virtual host (about ~3-5k domains on each server).
Now we use new location for every "valid time" but we want to more automatic that process. The best way is to have a dynamic configuration in one location.
Note:
See TracTickets
for help on using tickets.
Replying to avkarenow@…:
As of now, cache validity time can only be set with seconds granularity, much like in the
Cache-Control: max-age=
andExpires
headers.While currently there are no plans to change this, I think we can consider adding milliseconds if there are enough requests for this. Likely there will be various implementation problems though, as 32-bit signed integer can't hold more than 24 days in milliseconds.
Unless there are details on how do you plan to use it, I don't think it worth the effort. If you need to specify different validity times for different responses, you can use appropriate headers returned by the backend server, or use different location{} blocks with different
proxy_cache_valid
set.