src/http/modules/mxcache/ngx_http_mxcache_module.h File Reference

#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_tngx_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 Documentation

#define NGX_HTTP_MXCACHE_BUFFER_SIZE   4096

Typedef Documentation

Definition at line 33 of file ngx_http_mxcache_module.h.

Definition at line 32 of file ngx_http_mxcache_module.h.


Function Documentation

ngx_int_t ngx_http_mxcache_cleanup ( ngx_http_mxcache_conn_t conn  ) 
ngx_http_mxcache_conn_t* ngx_http_mxcache_create_new ( ngx_http_request_t *  r  ) 
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 }

Parameters:
conn mxcache structure
Returns:
NGX_*

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  ) 
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 }

Parameters:
conn mxcache structure
Todo:
add configurable data size limit - for default mcached accept no more than 1MB.
Returns:
NGX_*

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().


Generated on Mon Oct 12 14:03:36 2009 for XXSLT by  doxygen 1.6.1