Nginx 缓存针对打开的文件句柄与原文件信息

L:108 

open_file_cache

syntax: open_file_cache off;

     open_file_cache max=N[inactive=time](inactive表示如果在指定时间内没有访问则移除缓存); 

default: off;

context:http,server,location

  

 

open_file_cache_errors 针对缓存信息错误的是否缓存

open_file_cache_min_uses  是指至少使用指定的次数才会保留在缓存中

open_file_cache_valid 根据指定时间确定缓存是否有效,否则就更新缓存

server {
        listen    80;
        server_name  shop**.com.cn;
        root /tmp_html;
        location /{
                open_file_cache max=10 inactive=60s;
                open_file_cache_min_uses 1;
                open_file_cache_valid 60;
                open_file_cache_errors on;
        } 
}   

 

当我们用命令 strace -p nginx子进程号去看

会发现第一次会有Open打开文件句柄

第二次就没有open和close操作了 

 

 

posted on 2019-05-15 16:51  _Jee  阅读(447)  评论(0编辑  收藏  举报

导航