All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Cache Utility Functions
Collaboration diagram for Cache Utility Functions:

Data Structures

struct  cache_enable
struct  cache_disable
struct  cache_server_conf
struct  cache_dir_conf
struct  cache_provider_list
struct  cache_request_rec


#define MAX(a, b)   ((a) > (b) ? (a) : (b))
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
#define MSEC_ONE_DAY   ((apr_time_t)(86400*APR_USEC_PER_SEC)) /* one day, in microseconds */
#define MSEC_ONE_HR   ((apr_time_t)(3600*APR_USEC_PER_SEC)) /* one hour, in microseconds */
#define MSEC_ONE_MIN   ((apr_time_t)(60*APR_USEC_PER_SEC)) /* one minute, in microseconds */
#define MSEC_ONE_SEC   ((apr_time_t)(APR_USEC_PER_SEC)) /* one second, in microseconds */
#define DEFAULT_X_CACHE   0
#define DEFAULT_CACHE_LOCKPATH   "mod_cache-lock"
#define CACHE_LOCKNAME_KEY   "mod_cache-lockname"
#define CACHE_LOCKFILE_KEY   "mod_cache-lockfile"
#define CACHE_CTX_KEY   "mod_cache-ctx"
#define CACHE_SEPARATOR   ", \t"


typedef struct cache_provider_list cache_provider_list


int ap_cache_check_no_cache (cache_request_rec *cache, request_rec *r)
int ap_cache_check_no_store (cache_request_rec *cache, request_rec *r)
int cache_check_freshness (cache_handle_t *h, cache_request_rec *cache, request_rec *r)
apr_status_t cache_try_lock (cache_server_conf *conf, cache_request_rec *cache, request_rec *r)
apr_status_t cache_remove_lock (cache_server_conf *conf, cache_request_rec *cache, request_rec *r, apr_bucket_brigade *bb)
cache_provider_listcache_get_providers (request_rec *r, cache_server_conf *conf)
const char * cache_table_getm (apr_pool_t *p, const apr_table_t *t, const char *key)
char * cache_strqtok (char *str, const char *sep, char **last)
apr_table_tcache_merge_headers_out (request_rec *r)
int cache_use_early_url (request_rec *r)

Detailed Description

Macro Definition Documentation

#define CACHE_CTX_KEY   "mod_cache-ctx"
#define CACHE_LOCKFILE_KEY   "mod_cache-lockfile"
#define CACHE_LOCKNAME_KEY   "mod_cache-lockname"
#define CACHE_SEPARATOR   ", \t"
#define DEFAULT_CACHE_LOCKPATH   "mod_cache-lock"
#define DEFAULT_X_CACHE   0
#define MAX (   a,
)    ((a) > (b) ? (a) : (b))
#define MIN (   a,
)    ((a) < (b) ? (a) : (b))
#define MSEC_ONE_DAY   ((apr_time_t)(86400*APR_USEC_PER_SEC)) /* one day, in microseconds */
#define MSEC_ONE_HR   ((apr_time_t)(3600*APR_USEC_PER_SEC)) /* one hour, in microseconds */
#define MSEC_ONE_MIN   ((apr_time_t)(60*APR_USEC_PER_SEC)) /* one minute, in microseconds */
#define MSEC_ONE_SEC   ((apr_time_t)(APR_USEC_PER_SEC)) /* one second, in microseconds */

Typedef Documentation

Function Documentation

int ap_cache_check_no_cache ( cache_request_rec cache,
request_rec r 

Check the whether the request allows a cached object to be served as per RFC2616 section 14.9.4 (Cache Revalidation and Reload Controls)

0 ==> cache object may not be served, 1 ==> cache object may be served
int ap_cache_check_no_store ( cache_request_rec cache,
request_rec r 

Check the whether the request allows a cached object to be stored as per RFC2616 section 14.9.2 (What May be Stored by Caches)

0 ==> cache object may not be served, 1 ==> cache object may be served
int cache_check_freshness ( cache_handle_t h,
cache_request_rec cache,
request_rec r 

Check the freshness of the cache object per RFC2616 section 13.2 (Expiration Model)

0 ==> cache object is stale, 1 ==> cache object is fresh
cache_provider_list* cache_get_providers ( request_rec r,
cache_server_conf conf 
apr_table_t* cache_merge_headers_out ( request_rec r)

Merge err_headers_out into headers_out and add request's Content-Type and Content-Encoding if available.

apr_status_t cache_remove_lock ( cache_server_conf conf,
cache_request_rec cache,
request_rec r,
apr_bucket_brigade bb 

Remove the cache lock, if present.

First, try to close the file handle, whose delete-on-close should kill the file. Otherwise, just delete the file by name.

If no lock name has yet been calculated, do the calculation of the lock name first before trying to delete the file.

If an optional bucket brigade is passed, the lock will only be removed if the bucket brigade contains an EOS bucket.

char* cache_strqtok ( char *  str,
const char *  sep,
char **  last 

String tokenizer that ignores separator characters within quoted strings and escaped characters, as per RFC2616 section 2.2.

const char* cache_table_getm ( apr_pool_t p,
const apr_table_t t,
const char *  key 

Get a value from a table, where the table may contain multiple values for a given key.

When the table contains a single value, that value is returned unchanged.

When the table contains two or more values for a key, all values for the key are returned, separated by commas.

apr_status_t cache_try_lock ( cache_server_conf conf,
cache_request_rec cache,
request_rec r 

Try obtain a cache wide lock on the given cache key.

If we return APR_SUCCESS, we obtained the lock, and we are clear to proceed to the backend. If we return APR_EEXISTS, then the lock is already locked, someone else has gone to refresh the backend data already, so we must return stale data with a warning in the mean time. If we return anything else, then something has gone pear shaped, and we allow the request through to the backend regardless.

This lock is created from the request pool, meaning that should something go wrong and the lock isn't deleted on return of the request headers from the backend for whatever reason, at worst the lock will be cleaned up when the request is dies or finishes.

If something goes truly bananas and the lock isn't deleted when the request dies, the lock will be trashed when its max-age is reached, or when a request arrives containing a Cache-Control: no-cache. At no point is it possible for this lock to permanently deny access to the backend.

int cache_use_early_url ( request_rec r)

Return whether to use request's path/query from early stage (r->parsed_uri) or the current/rewritable ones (r->uri/r->args).