xin

memcached_pass

Proxies a location to a memcached get, nginx's own read-only single-key gateway.

Syntaxmemcached_pass address | unix:path | upstream_name;
Contextslocationif in location

Behavior

Issues one get $memcached_key against the target and maps the reply to 200 (hit), 404 (miss) or 502 (invalid reply). $memcached_key must be set explicitly; there is no automatic key derivation. Use memc_pass for the full memcached command set including writes.

Example

location /cache/ {
    set $memcached_key $uri;
    memcached_pass 127.0.0.1:11211;
}

Related directives

memcached_next_upstream · memcached_gzip_flag · memc_pass