Nginx cache files by mime type using ngx_srcache module
agentzh at gmail.com
Thu Jun 13 19:38:32 UTC 2013
On Wed, Jun 12, 2013 at 3:51 AM, n1xman wrote:
> However, I have noticed every srcache_fetch GET /memc subrequest hits the
> memcached even though srcache_store skipped content-type which is not
The cache fetch operation must be performed *before* sending a request
to the backend while the Content-Type response header is only
available *after* the backend request is already sent. You're having a
chicken and egg problem here. And I don't see how the srcache_fetch
can be skipped without a Content-Type response header available for
> This will keep busy the memcached server and I think srcache_fetch GET
> subrequest should not executed if srcache_store_skip triggered first.
Are you sure?
srcache_store_skip always runs after srcache_fetch for a particular
request. The caching workflow looks like this:
send backend request if it's a cache miss
receive backend response (headers)
I cannot see how srcache_store_skip can be triggered before
srcache_fetch without sending a backend request to get the
Content-Type response header.
More information about the nginx