FAQ

Page Discussion History

Difference between revisions of "HttpMemcachedModule"

(remove unneeded time units, they are in ConfigNotation)
 
m (References: Update link to the original documentation)
Line 82: Line 82:
 
= References =
 
= References =
  
[http://sysoev.ru/nginx/docs/http/ngx_http_memcached_module.html Original Documentation]
+
[http://nginx.org/en/docs/http/ngx_http_memcached_module.html Original Documentation]
  
 
[http://lserinol.blogspot.com/2009/03/speeding-up-your-nginx-server-with.html] Speeding up your nginx server with memcached
 
[http://lserinol.blogspot.com/2009/03/speeding-up-your-nginx-server-with.html] Speeding up your nginx server with memcached

Revision as of 15:35, 21 April 2012

Contents

Synopsis

You can use this module to perform simple caching.

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: 60s

context: http, server, location

The timeout for connecting to memcached.

memcached_read_timeout

syntax: memcached_read_timeout [ time ]

default: 60s

context: http, server, location

The timeout for reading from memcached.

memcached_send_timeout

syntax: memcached_send_timeout [ time ]

default: 60s

context: http, server, location

The timeout for sending to memcached.

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

Original Documentation

[1] Speeding up your nginx server with memcached

See Also

  • The 3rd-party memc module that supports almost the whole memcached TCP protocol.