Apache2
ap_socache_provider_t Struct Reference

#include <ap_socache.h>

Data Fields

const char * name
 
unsigned int flags
 
const char *(* create )(ap_socache_instance_t **instance, const char *arg, apr_pool_t *tmp, apr_pool_t *p)
 
apr_status_t(* init )(ap_socache_instance_t *instance, const char *cname, const struct ap_socache_hints *hints, server_rec *s, apr_pool_t *pool)
 
void(* destroy )(ap_socache_instance_t *instance, server_rec *s)
 
apr_status_t(* store )(ap_socache_instance_t *instance, server_rec *s, const unsigned char *id, unsigned int idlen, apr_time_t expiry, unsigned char *data, unsigned int datalen, apr_pool_t *pool)
 
apr_status_t(* retrieve )(ap_socache_instance_t *instance, server_rec *s, const unsigned char *id, unsigned int idlen, unsigned char *data, unsigned int *datalen, apr_pool_t *pool)
 
apr_status_t(* remove )(ap_socache_instance_t *instance, server_rec *s, const unsigned char *id, unsigned int idlen, apr_pool_t *pool)
 
void(* status )(ap_socache_instance_t *instance, request_rec *r, int flags)
 
apr_status_t(* iterate )(ap_socache_instance_t *instance, server_rec *s, void *userctx, ap_socache_iterator_t *iterator, apr_pool_t *pool)
 

Detailed Description

A socache provider structure. socache providers are registered with the ap_provider.h interface using the AP_SOCACHE_PROVIDER_* constants.

Field Documentation

◆ create

const char*(* ap_socache_provider_t::create) (ap_socache_instance_t **instance, const char *arg, apr_pool_t *tmp, apr_pool_t *p)

Create a small object cache based on the given configuration string. The instance pointer returned in the instance parameter will be passed as the first argument to subsequent invocations.

Parameters
instanceOutput parameter to which instance object is written.
argUser-specified configuration string. May be NULL to force use of defaults.
tmpPool to be used for any temporary allocations
pPool to be use for any allocations lasting as long as the created instance
Returns
NULL on success, or an error string on failure.

◆ destroy

void(* ap_socache_provider_t::destroy) (ap_socache_instance_t *instance, server_rec *s)

Destroy a given cache instance object.

Parameters
instanceThe cache instance to destroy.
sAssociated server structure (for logging purposes)

◆ flags

unsigned int ap_socache_provider_t::flags

Bitmask of AP_SOCACHE_FLAG_* flags.

◆ init

apr_status_t(* ap_socache_provider_t::init) (ap_socache_instance_t *instance, const char *cname, const struct ap_socache_hints *hints, server_rec *s, apr_pool_t *pool)

Initialize the cache. The cname must be of maximum length 16 characters, and uniquely identifies the consumer of the cache within the server; using the module name is recommended, e.g. "mod_ssl-sess". This string may be used within a filesystem path so use of only alphanumeric [a-z0-9_-] characters is recommended. If hints is non-NULL, it gives a set of hints for the provider. Returns APR error code.

Parameters
instanceThe cache instance
cnameA unique string identifying the consumer of this API
hintsOptional hints argument describing expected cache use
sServer structure to which the cache is associated
poolPool for long-lived allocations
Returns
APR status value indicating success.

◆ iterate

apr_status_t(* ap_socache_provider_t::iterate) (ap_socache_instance_t *instance, server_rec *s, void *userctx, ap_socache_iterator_t *iterator, apr_pool_t *pool)

Dump all cached objects through an iterator callback.

Parameters
instanceThe cache instance
sAssociated server context (for processing and logging)
userctxUser defined pointer passed through to the iterator
iteratorThe user provided callback function which will receive individual calls for each unexpired id/data pair
poolPool for temporary allocations.
Returns
APR status value; APR_NOTFOUND if the object was not found

◆ name

const char* ap_socache_provider_t::name

Canonical provider name.

◆ remove

apr_status_t(* ap_socache_provider_t::remove) (ap_socache_instance_t *instance, server_rec *s, const unsigned char *id, unsigned int idlen, apr_pool_t *pool)

Remove an object from the cache

Parameters
instanceThe cache instance
sAssociated server structure (for logging purposes)
idUnique ID for the object; binary blob
idlenLength of id blob
poolPool for temporary allocations.

◆ retrieve

apr_status_t(* ap_socache_provider_t::retrieve) (ap_socache_instance_t *instance, server_rec *s, const unsigned char *id, unsigned int idlen, unsigned char *data, unsigned int *datalen, apr_pool_t *pool)

Retrieve a cached object.

Parameters
instanceThe cache instance
sAssociated server structure (for logging purposes)
idUnique ID for the object; binary blob
idlenLength of id blob
dataOutput buffer to place retrievd data (binary blob)
datalenOn entry, length of data buffer; on exit, the number of bytes written to the data buffer.
poolPool for temporary allocations.
Returns
APR status value; APR_NOTFOUND if the object was not found

◆ status

void(* ap_socache_provider_t::status) (ap_socache_instance_t *instance, request_rec *r, int flags)

Dump the status of a cache instance for mod_status. Will use the ap_r* interfaces to produce appropriate status output. XXX: ap_r* are deprecated, bad dogfood

Parameters
instanceThe cache instance
rThe request structure
flagsThe AP_STATUS_* constants used (see mod_status.h)

◆ store

apr_status_t(* ap_socache_provider_t::store) (ap_socache_instance_t *instance, server_rec *s, const unsigned char *id, unsigned int idlen, apr_time_t expiry, unsigned char *data, unsigned int datalen, apr_pool_t *pool)

Store an object in a cache instance.

Parameters
instanceThe cache instance
sAssociated server structure (for logging purposes)
idUnique ID for the object; binary blob
idlenLength of id blob
expiryAbsolute time at which the object expires
dataData to store; binary blob
datalenLength of data blob
poolPool for temporary allocations.
Returns
APR status value.

The documentation for this struct was generated from the following file: