Apache HTTPD
Classes | Macros | Typedefs | Functions | Variables
mod_cache_socache.c File Reference
#include "apr_lib.h"
#include "apr_file_io.h"
#include "apr_strings.h"
#include "apr_buckets.h"
#include "apr_version.h"
#include "apu_version.h"
#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
#include "http_core.h"
#include "http_protocol.h"
#include "ap_provider.h"
#include "ap_socache.h"
#include "util_filter.h"
#include "util_script.h"
#include "util_charset.h"
#include "util_mutex.h"
#include "mod_cache.h"
#include "mod_status.h"
#include "cache_socache_common.h"

Go to the source code of this file.

Classes

struct  cache_socache_object_t
 
struct  cache_socache_provider_conf
 
struct  cache_socache_conf
 
struct  cache_socache_dir_conf
 

Macros

#define DEFAULT_MAX_FILE_SIZE   100*1024
 
#define DEFAULT_MAXTIME   86400
 
#define DEFAULT_MINTIME   600
 
#define DEFAULT_READSIZE   0
 
#define DEFAULT_READTIME   0
 

Typedefs

typedef struct cache_socache_object_t cache_socache_object_t
 
typedef struct cache_socache_provider_conf cache_socache_provider_conf
 
typedef struct cache_socache_conf cache_socache_conf
 
typedef struct cache_socache_dir_conf cache_socache_dir_conf
 

Functions

static apr_status_t read_array (request_rec *r, apr_array_header_t *arr, unsigned char *buffer, apr_size_t buffer_len, apr_size_t *slider)
 
static apr_status_t store_array (apr_array_header_t *arr, unsigned char *buffer, apr_size_t buffer_len, apr_size_t *slider)
 
static apr_status_t read_table (cache_handle_t *handle, request_rec *r, apr_table_t *table, unsigned char *buffer, apr_size_t buffer_len, apr_size_t *slider)
 
static apr_status_t store_table (apr_table_t *table, unsigned char *buffer, apr_size_t buffer_len, apr_size_t *slider)
 
static const charregen_key (apr_pool_t *p, apr_table_t *headers, apr_array_header_t *varray, const char *oldkey, apr_size_t *newkeylen)
 
static int array_alphasort (const void *fn1, const void *fn2)
 
static void tokens_to_array (apr_pool_t *p, const char *data, apr_array_header_t *arr)
 
static int create_entity (cache_handle_t *h, request_rec *r, const char *key, apr_off_t len, apr_bucket_brigade *bb)
 
static apr_status_t sobj_body_pre_cleanup (void *baton)
 
static int open_entity (cache_handle_t *h, request_rec *r, const char *key)
 
static int remove_entity (cache_handle_t *h)
 
static int remove_url (cache_handle_t *h, request_rec *r)
 
static apr_status_t recall_headers (cache_handle_t *h, request_rec *r)
 
static apr_status_t recall_body (cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb)
 
static apr_status_t store_headers (cache_handle_t *h, request_rec *r, cache_info *info)
 
static apr_status_t store_body (cache_handle_t *h, request_rec *r, apr_bucket_brigade *in, apr_bucket_brigade *out)
 
static apr_status_t commit_entity (cache_handle_t *h, request_rec *r)
 
static apr_status_t invalidate_entity (cache_handle_t *h, request_rec *r)
 
static void * create_dir_config (apr_pool_t *p, char *dummy)
 
static void * merge_dir_config (apr_pool_t *p, void *basev, void *addv)
 
static void * create_config (apr_pool_t *p, server_rec *s)
 
static void * merge_config (apr_pool_t *p, void *basev, void *overridesv)
 
static const charset_cache_socache (cmd_parms *cmd, void *in_struct_ptr, const char *arg)
 
static const charset_cache_max (cmd_parms *parms, void *in_struct_ptr, const char *arg)
 
static const charset_cache_maxtime (cmd_parms *parms, void *in_struct_ptr, const char *arg)
 
static const charset_cache_mintime (cmd_parms *parms, void *in_struct_ptr, const char *arg)
 
static const charset_cache_readsize (cmd_parms *parms, void *in_struct_ptr, const char *arg)
 
static const charset_cache_readtime (cmd_parms *parms, void *in_struct_ptr, const char *arg)
 
static apr_status_t remove_lock (void *data)
 
static apr_status_t destroy_cache (void *data)
 
static int socache_status_hook (request_rec *r, int flags)
 
static void socache_status_register (apr_pool_t *p)
 
static int socache_precfg (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptmp)
 
static int socache_post_config (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptmp, server_rec *base_server)
 
static void socache_child_init (apr_pool_t *p, server_rec *s)
 
static void cache_socache_register_hook (apr_pool_t *p)
 

Variables

static const char *const cache_socache_id = "cache-socache"
 
static apr_global_mutex_tsocache_mutex = NULL
 
static const command_rec cache_socache_cmds []
 
static const cache_provider cache_socache_provider
 
static int *const aplog_module_index = &( cache_socache_module.module_index)
 

Macro Definition Documentation

◆ DEFAULT_MAX_FILE_SIZE

#define DEFAULT_MAX_FILE_SIZE   100*1024

Definition at line 99 of file mod_cache_socache.c.

◆ DEFAULT_MAXTIME

#define DEFAULT_MAXTIME   86400

Definition at line 100 of file mod_cache_socache.c.

◆ DEFAULT_MINTIME

#define DEFAULT_MINTIME   600

Definition at line 101 of file mod_cache_socache.c.

◆ DEFAULT_READSIZE

#define DEFAULT_READSIZE   0

Definition at line 102 of file mod_cache_socache.c.

◆ DEFAULT_READTIME

#define DEFAULT_READTIME   0

Definition at line 103 of file mod_cache_socache.c.

Typedef Documentation

◆ cache_socache_conf

◆ cache_socache_dir_conf

◆ cache_socache_object_t

◆ cache_socache_provider_conf

Function Documentation

◆ array_alphasort()

static int array_alphasort ( const void *  fn1,
const void *  fn2 
)
static

Definition at line 336 of file mod_cache_socache.c.

◆ cache_socache_register_hook()

static void cache_socache_register_hook ( apr_pool_t p)
static

Definition at line 1526 of file mod_cache_socache.c.

◆ commit_entity()

static apr_status_t commit_entity ( cache_handle_t h,
request_rec r 
)
static

Definition at line 1086 of file mod_cache_socache.c.

◆ create_config()

static void * create_config ( apr_pool_t p,
server_rec s 
)
static

Definition at line 1206 of file mod_cache_socache.c.

◆ create_dir_config()

static void * create_dir_config ( apr_pool_t p,
char dummy 
)
static

Definition at line 1170 of file mod_cache_socache.c.

◆ create_entity()

static int create_entity ( cache_handle_t h,
request_rec r,
const char key,
apr_off_t  len,
apr_bucket_brigade bb 
)
static

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module has handled this stage.

Definition at line 357 of file mod_cache_socache.c.

◆ destroy_cache()

static apr_status_t destroy_cache ( void *  data)
static

Definition at line 1340 of file mod_cache_socache.c.

◆ invalidate_entity()

static apr_status_t invalidate_entity ( cache_handle_t h,
request_rec r 
)
static

Definition at line 1162 of file mod_cache_socache.c.

◆ merge_config()

static void * merge_config ( apr_pool_t p,
void *  basev,
void *  overridesv 
)
static

Definition at line 1213 of file mod_cache_socache.c.

◆ merge_dir_config()

static void * merge_dir_config ( apr_pool_t p,
void *  basev,
void *  addv 
)
static

Definition at line 1184 of file mod_cache_socache.c.

◆ open_entity()

static int open_entity ( cache_handle_t h,
request_rec r,
const char key 
)
static

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module has handled this stage.

< Module declines to handle

< Module declines to handle

Definition at line 446 of file mod_cache_socache.c.

◆ read_array()

static apr_status_t read_array ( request_rec r,
apr_array_header_t arr,
unsigned char buffer,
apr_size_t  buffer_len,
apr_size_t slider 
)
static

Definition at line 139 of file mod_cache_socache.c.

◆ read_table()

static apr_status_t read_table ( cache_handle_t handle,
request_rec r,
apr_table_t table,
unsigned char buffer,
apr_size_t  buffer_len,
apr_size_t slider 
)
static

Definition at line 195 of file mod_cache_socache.c.

◆ recall_body()

static apr_status_t recall_body ( cache_handle_t h,
apr_pool_t p,
apr_bucket_brigade bb 
)
static

Definition at line 769 of file mod_cache_socache.c.

◆ recall_headers()

static apr_status_t recall_headers ( cache_handle_t h,
request_rec r 
)
static

Definition at line 763 of file mod_cache_socache.c.

◆ regen_key()

static const char * regen_key ( apr_pool_t p,
apr_table_t headers,
apr_array_header_t varray,
const char oldkey,
apr_size_t newkeylen 
)
static

Definition at line 279 of file mod_cache_socache.c.

◆ remove_entity()

static int remove_entity ( cache_handle_t h)
static

< Module has handled this stage.

Definition at line 718 of file mod_cache_socache.c.

◆ remove_lock()

static apr_status_t remove_lock ( void *  data)
static

Definition at line 1331 of file mod_cache_socache.c.

◆ remove_url()

static int remove_url ( cache_handle_t h,
request_rec r 
)
static

< Module declines to handle

< Module declines to handle

< Module declines to handle

< Module has handled this stage.

Definition at line 725 of file mod_cache_socache.c.

◆ set_cache_max()

static const char * set_cache_max ( cmd_parms parms,
void *  in_struct_ptr,
const char arg 
)
static

Definition at line 1260 of file mod_cache_socache.c.

◆ set_cache_maxtime()

static const char * set_cache_maxtime ( cmd_parms parms,
void *  in_struct_ptr,
const char arg 
)
static

Definition at line 1275 of file mod_cache_socache.c.

◆ set_cache_mintime()

static const char * set_cache_mintime ( cmd_parms parms,
void *  in_struct_ptr,
const char arg 
)
static

Definition at line 1289 of file mod_cache_socache.c.

◆ set_cache_readsize()

static const char * set_cache_readsize ( cmd_parms parms,
void *  in_struct_ptr,
const char arg 
)
static

Definition at line 1303 of file mod_cache_socache.c.

◆ set_cache_readtime()

static const char * set_cache_readtime ( cmd_parms parms,
void *  in_struct_ptr,
const char arg 
)
static

Definition at line 1316 of file mod_cache_socache.c.

◆ set_cache_socache()

static const char * set_cache_socache ( cmd_parms cmd,
void *  in_struct_ptr,
const char arg 
)
static

Definition at line 1228 of file mod_cache_socache.c.

◆ sobj_body_pre_cleanup()

static apr_status_t sobj_body_pre_cleanup ( void *  baton)
static

Definition at line 438 of file mod_cache_socache.c.

◆ socache_child_init()

static void socache_child_init ( apr_pool_t p,
server_rec s 
)
static

Definition at line 1487 of file mod_cache_socache.c.

◆ socache_post_config()

static int socache_post_config ( apr_pool_t pconf,
apr_pool_t plog,
apr_pool_t ptmp,
server_rec base_server 
)
static

< Module has handled this stage.

Definition at line 1431 of file mod_cache_socache.c.

◆ socache_precfg()

static int socache_precfg ( apr_pool_t pconf,
apr_pool_t plog,
apr_pool_t ptmp 
)
static

< Module has handled this stage.

Definition at line 1415 of file mod_cache_socache.c.

◆ socache_status_hook()

static int socache_status_hook ( request_rec r,
int  flags 
)
static

< Module declines to handle

< Module has handled this stage.

Definition at line 1353 of file mod_cache_socache.c.

◆ socache_status_register()

static void socache_status_register ( apr_pool_t p)
static

Definition at line 1410 of file mod_cache_socache.c.

◆ store_array()

static apr_status_t store_array ( apr_array_header_t arr,
unsigned char buffer,
apr_size_t  buffer_len,
apr_size_t slider 
)
static

Definition at line 170 of file mod_cache_socache.c.

◆ store_body()

static apr_status_t store_body ( cache_handle_t h,
request_rec r,
apr_bucket_brigade in,
apr_bucket_brigade out 
)
static

Definition at line 940 of file mod_cache_socache.c.

◆ store_headers()

static apr_status_t store_headers ( cache_handle_t h,
request_rec r,
cache_info info 
)
static

Definition at line 781 of file mod_cache_socache.c.

◆ store_table()

static apr_status_t store_table ( apr_table_t table,
unsigned char buffer,
apr_size_t  buffer_len,
apr_size_t slider 
)
static

Definition at line 248 of file mod_cache_socache.c.

◆ tokens_to_array()

static void tokens_to_array ( apr_pool_t p,
const char data,
apr_array_header_t arr 
)
static

Definition at line 341 of file mod_cache_socache.c.

Variable Documentation

◆ aplog_module_index

int* const aplog_module_index = &( cache_socache_module.module_index)
static

Definition at line 1536 of file mod_cache_socache.c.

◆ cache_socache_cmds

const command_rec cache_socache_cmds[]
static
Initial value:
=
{
{ "CacheSocache" , set_cache_socache , NULL , 128 , TAKE1, "The shared object cache to store cache files" },
{ "CacheSocacheMaxTime" , set_cache_maxtime , NULL , 128 | 64 , TAKE1, "The maximum cache expiry age to cache a document in seconds" },
{ "CacheSocacheMinTime" , set_cache_mintime , NULL , 128 | 64 , TAKE1, "The minimum cache expiry age to cache a document in seconds" },
{ "CacheSocacheMaxSize" , set_cache_max , NULL , 128 | 64 , TAKE1, "The maximum cache entry size (headers and body) to cache a document" },
{ "CacheSocacheReadSize" , set_cache_readsize , NULL , 128 | 64 , TAKE1, "The maximum quantity of data to attempt to read and cache in one go" },
{ "CacheSocacheReadTime" , set_cache_readtime , NULL , 128 | 64 , TAKE1, "The maximum time taken to attempt to read and cache in go" },
{ NULL }
}
@ TAKE1
Definition http_config.h:51
static const char * set_cache_maxtime(cmd_parms *parms, void *in_struct_ptr, const char *arg)
static const char * set_cache_readsize(cmd_parms *parms, void *in_struct_ptr, const char *arg)
static const char * set_cache_mintime(cmd_parms *parms, void *in_struct_ptr, const char *arg)
static const char * set_cache_socache(cmd_parms *cmd, void *in_struct_ptr, const char *arg)
static const char * set_cache_max(cmd_parms *parms, void *in_struct_ptr, const char *arg)
static const char * set_cache_readtime(cmd_parms *parms, void *in_struct_ptr, const char *arg)
return NULL
Definition mod_so.c:359

Definition at line 1502 of file mod_cache_socache.c.

◆ cache_socache_id

const char* const cache_socache_id = "cache-socache"
static

Definition at line 132 of file mod_cache_socache.c.

◆ cache_socache_provider

const cache_provider cache_socache_provider
static
Initial value:
=
{
}
static apr_status_t recall_body(cache_handle_t *h, apr_pool_t *p, apr_bucket_brigade *bb)
static int remove_entity(cache_handle_t *h)
static apr_status_t store_body(cache_handle_t *h, request_rec *r, apr_bucket_brigade *in, apr_bucket_brigade *out)
static apr_status_t commit_entity(cache_handle_t *h, request_rec *r)
static int create_entity(cache_handle_t *h, request_rec *r, const char *key, apr_off_t len, apr_bucket_brigade *bb)
static apr_status_t invalidate_entity(cache_handle_t *h, request_rec *r)
static int open_entity(cache_handle_t *h, request_rec *r, const char *key)
static apr_status_t recall_headers(cache_handle_t *h, request_rec *r)
static apr_status_t store_headers(cache_handle_t *h, request_rec *r, cache_info *info)
static int remove_url(cache_handle_t *h, request_rec *r)

Definition at line 1519 of file mod_cache_socache.c.

◆ socache_mutex

apr_global_mutex_t* socache_mutex = NULL
static

Definition at line 133 of file mod_cache_socache.c.