NginxHttpMemcachedModule
Contents |
Synopsis
You can use this module to perform simple caching. There are plans to extend this module in the near future.
Example configuration
server { location / { set $memcached_key $uri; memcached_pass name:11211; default_type text/html; error_page 404 = /fallback; } location = /fallback { proxy_pass backend; } }
Or, if using Nginx 0.7.x:
server { location / { set $memcached_key $uri; memcached_pass name:11211; default_type text/html; error_page 404 @fallback; } location @fallback { proxy_pass backend; } }
Directives
memcached_pass
syntax: memcached_pass [ name:port ]
default: none
context: http, server, location
The backend should set the data in memcached. The memcached key is "/uri?args".
Since 0.5.9 the memcached key is now in $memcached_key.
memcached_connect_timeout
syntax: memcached_connect_timeout [ time ]
default: 60000
context: http, server, location
The timeout for connecting to memcached, in milliseconds.
memcached_read_timeout
syntax: memcached_read_timeout [ time ]
default: 60000
context: http, server, location
The timeout for reading from memcached, in milliseconds.
memcached_send_timeout
syntax: memcached_send_timeout [ time ]
default: 60000
context: http, server, location
The timeout for sending to memcached, in milliseconds.
memcached_buffer_size
syntax: memcached_buffer_size [ size ]
default: see getpagesize(2)
context: http, server, location
The recv/send buffer size, in bytes.
memcached_next_upstream
syntax: memcached_next_upstream [ error | timeout | invalid_response | not_found | off ]
default: error timeout
context: http, server, location
Which failure conditions should cause the request to be forwarded to another upstream server? Applies only when the value in memcached_pass is an upstream with two or more servers.
Variables
$memcached_key
The value of the memcached key.
References
Speeding up your nginx server with memcached
[1] Speeding up your nginx server with memcached
See Also
- The 3rd-party memc module that supports almost the whole memcached TCP protocol.












