[edit] scgi_cache_path

syntax: scgi_cache_path path [levels=m:n] keys_zone=name:size [inactive=time] [max_size=size]

default: none

context: http

The clean_time parameter was removed in 0.7.45.

This directive specifies path to the cache storage and other cache parameters. All data is stored in the files. The cache key and the name of cache file are calculated as MD5 sum of the proxied URL.

Level parameter sets number and width of the names of subdirectories used to store caching files. For example, with the directive like:

scgi_cache_path  /data/nginx/cache  levels=1:2   keys_zone=one:10m;

the data will be stored in the following file:

/data/nginx/cache/c/29/b7f54b2df7773722d382f4809d65029c

Caching data is first written to the temporary file which is then moved to the final location in a cache directory. Starting from 0.8.9 it is possible to store temporary and cache files on different file systems, but it should be kept in mind that in such a case instead of cheap and atomic rename syscall a full file copy is performed. So it's better to use the same file system in both parameters of scgi_temp_path and scgi_cache_path directives.

In addition, all active keys and information about data are kept in the shared memory zone, which name and size are specified by the options of the key_zone parameter. In case this data haven't been accessed for the time, specified in the option of inactive parameter, it is wiped out from the memory. By default inactive period is set to 10 minutes.

To maintain the maximum size of the cache, which is set by max_size parameter, a special process cache manager periodically deletes old data from the cache.


Module: HttpScgiModule