#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include "ngx_connection_pool.h"
Go to the source code of this file.
Data Structures | |
struct | ngx_http_mxcache_conn_s |
MXCache structure. More... | |
struct | ngx_http_mxcache_conf_t |
MXCache configuration structure. More... | |
Defines | |
#define | NGX_HTTP_MXCACHE_BUFFER_SIZE 4096 |
Typedefs | |
typedef struct ngx_http_mxcache_conn_s | ngx_http_mxcache_conn_t |
typedef void(* | ngx_http_mxcache_conn_handler_pt )(ngx_http_mxcache_conn_t *conn) |
Functions | |
ngx_int_t | ngx_http_mxcache_is_enabled (ngx_http_request_t *r) |
Checks if the module is enabled in config file. | |
ngx_http_mxcache_conn_t * | ngx_http_mxcache_create_new (ngx_http_request_t *r) |
Creates and initializes new mxcache structure. | |
ngx_int_t | ngx_http_mxcache_get (ngx_http_mxcache_conn_t *conn) |
Gets data from memcached - calls done_handler when data are ready. | |
ngx_int_t | ngx_http_mxcache_set (ngx_http_mxcache_conn_t *conn) |
Sets data to memcached - after all call done_handler. | |
ngx_int_t | ngx_http_mxcache_cleanup (ngx_http_mxcache_conn_t *conn) |
Cancels mxcache, free all mxcache resources. |
#define NGX_HTTP_MXCACHE_BUFFER_SIZE 4096 |
Definition at line 30 of file ngx_http_mxcache_module.h.
Referenced by ngx_http_mxcache_create_conf(), ngx_http_mxcache_create_new(), ngx_http_mxcache_init_conn(), and ngx_http_mxcache_read_handler().
typedef void(* ngx_http_mxcache_conn_handler_pt)(ngx_http_mxcache_conn_t *conn) |
Definition at line 33 of file ngx_http_mxcache_module.h.
typedef struct ngx_http_mxcache_conn_s ngx_http_mxcache_conn_t |
Definition at line 32 of file ngx_http_mxcache_module.h.
ngx_int_t ngx_http_mxcache_cleanup | ( | ngx_http_mxcache_conn_t * | conn | ) |
Cancels mxcache, free all mxcache resources.
conn | mxcache structure |
Definition at line 352 of file ngx_http_mxcache_module.c.
References ngx_http_mxcache_conn_s::connection, ngx_http_mxcache_conn_s::done, ngx_http_mxcache_conn_s::done_handler, ngx_http_mxcache_conn_s::log, ngx_http_mxcache_conn_s::pool, and ngx_http_mxcache_conn_s::terminated.
Referenced by ngx_http_mxcache_finalize_connection(), ngx_http_xslt2_xml_cleanup(), ngx_http_xslt2_xml_mxcache_set_handler(), ngx_http_xslt2_xml_set_cached_stylesheet(), ngx_http_xxslt_parse_cleanup(), ngx_http_xxslt_parse_get_cached_include(), ngx_http_xxslt_parse_mxcache_set_handler(), and ngx_http_xxslt_parse_set_cached_include().
ngx_http_mxcache_conn_t* ngx_http_mxcache_create_new | ( | ngx_http_request_t * | r | ) |
Creates and initializes new mxcache structure.
r | nginx http request |
Definition at line 156 of file ngx_http_mxcache_module.c.
References ngx_http_mxcache_conn_s::exp_time, ngx_http_mxcache_conf_t::expire, ngx_http_mxcache_conn_s::log, NGX_HTTP_MXCACHE_BUFFER_SIZE, ngx_http_mxcache_module, ngx_http_mxcache_conn_s::pool, ngx_http_mxcache_conn_s::r, ngx_http_mxcache_conn_s::read_timeout, ngx_http_mxcache_conn_s::rpool, ngx_http_mxcache_conf_t::server_timeout, and ngx_http_mxcache_conn_s::write_timeout.
Referenced by ngx_http_xslt2_xml_get_cached_stylesheet(), ngx_http_xslt2_xml_set_cached_stylesheet(), ngx_http_xxslt_parse_get_cached_include(), and ngx_http_xxslt_parse_set_cached_include().
ngx_int_t ngx_http_mxcache_get | ( | ngx_http_mxcache_conn_t * | conn | ) |
Gets data from memcached - calls done_handler when data are ready.
usage:
ngx_http_xcache_conn_t *conn;
conn = ngx_http_xcache_create_new(r);
conn->key = your_null_ended_u_char_key;
//void handler_called_after_all(ngx_http_xcache_conn_t *conn);
conn->done_handler = handler_called_after_all;
rc = ngx_http_xcache_get(conn); // send request, rc - ngx_int_t, error flag
void handler_called_after_all(ngx_http_xcache_conn_t *conn) { conn->error // error flag conn->out_bufs // value }
conn | mxcache structure |
Definition at line 226 of file ngx_http_mxcache_module.c.
References ngx_pooled_connection_s::connection, ngx_http_mxcache_conn_s::connection, ngx_http_mxcache_conf_t::enabled, ngx_http_mxcache_conn_s::log, ngx_http_mxcache_create_get_request(), ngx_http_mxcache_init_conn(), ngx_http_mxcache_module, ngx_http_mxcache_read_get_handler(), ngx_http_mxcache_write_handler(), ngx_http_mxcache_conn_s::out_bufs, ngx_http_mxcache_conn_s::out_bufs_tail, ngx_http_mxcache_conn_s::r, ngx_http_mxcache_conn_s::read_timeout, and ngx_http_mxcache_conn_s::write_timeout.
Referenced by ngx_http_xslt2_xml_get_cached_stylesheet(), and ngx_http_xxslt_parse_get_cached_include().
ngx_int_t ngx_http_mxcache_is_enabled | ( | ngx_http_request_t * | r | ) |
Checks if the module is enabled in config file.
r | nginx http request |
Definition at line 142 of file ngx_http_mxcache_module.c.
References ngx_http_mxcache_conf_t::enabled, and ngx_http_mxcache_module.
Referenced by ngx_http_xslt2_xml_get_cached_stylesheet(), ngx_http_xslt2_xml_set_cached_stylesheet(), ngx_http_xxslt_parse_get_cached_include(), and ngx_http_xxslt_parse_set_cached_include().
ngx_int_t ngx_http_mxcache_set | ( | ngx_http_mxcache_conn_t * | conn | ) |
Sets data to memcached - after all call done_handler.
usage:
ngx_http_xcache_conn_t *conn;
conn = ngx_http_xcache_create_new(r); // r - ngx_http_request_t
conn->key = your_null_ended_u_char_key;
conn->exp_time = expire_time_in_seconds;
conn->out_bufs = value_in_chain_link_bufs;
conn->out_bufs_tail = last_chain_link;
conn->bytes = number_of_bytes_in_out_bufs;
//void handler_called_after_all(ngx_http_xcache_conn_t *conn);
conn->done_handler = handler_called_after_all;
rc = ngx_http_xcache_set(conn); // send request, rc - ngx_int_t, error flag
void handler_called_after_all(ngx_http_xcache_conn_t *conn) { conn->error // error flag }
conn | mxcache structure |
Definition at line 303 of file ngx_http_mxcache_module.c.
References ngx_pooled_connection_s::connection, ngx_http_mxcache_conn_s::connection, ngx_http_mxcache_conf_t::enabled, ngx_http_mxcache_conn_s::log, ngx_http_mxcache_create_set_request(), ngx_http_mxcache_init_conn(), ngx_http_mxcache_module, ngx_http_mxcache_read_set_handler(), ngx_http_mxcache_write_handler(), ngx_http_mxcache_conn_s::out_bufs, ngx_http_mxcache_conn_s::out_bufs_tail, ngx_http_mxcache_conn_s::r, ngx_http_mxcache_conn_s::read_timeout, and ngx_http_mxcache_conn_s::write_timeout.
Referenced by ngx_http_xslt2_xml_set_cached_stylesheet(), and ngx_http_xxslt_parse_set_cached_include().