1
/* Licensed to the Apache Software Foundation (ASF) under one or more
2
* contributor license agreements. See the NOTICE file distributed with
3
* this work for additional information regarding copyright ownership.
4
* The ASF licenses this file to You under the Apache License, Version 2.0
5
* (the "License"); you may not use this file except in compliance with
6
* the License. You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
#ifndef MOD_DISK_CACHE_H
18
#define MOD_DISK_CACHE_H
21
* include for mod_disk_cache: Disk Based HTTP 1.1 Cache.
24
#define VARY_FORMAT_VERSION 3
25
#define DISK_FORMAT_VERSION 4
27
#define CACHE_HEADER_SUFFIX ".header"
28
#define CACHE_DATA_SUFFIX ".data"
29
#define CACHE_VDIR_SUFFIX ".vary"
31
#define AP_TEMPFILE_PREFIX "/"
32
#define AP_TEMPFILE_BASE "aptmp"
33
#define AP_TEMPFILE_SUFFIX "XXXXXX"
34
#define AP_TEMPFILE_BASELEN strlen(AP_TEMPFILE_BASE)
35
#define AP_TEMPFILE_NAMELEN strlen(AP_TEMPFILE_BASE AP_TEMPFILE_SUFFIX)
36
#define AP_TEMPFILE AP_TEMPFILE_PREFIX AP_TEMPFILE_BASE AP_TEMPFILE_SUFFIX
39
/* Indicates the format of the header struct stored on-disk. */
41
/* The HTTP status code returned for this response. */
43
/* The size of the entity name that follows. */
45
/* The number of times we've cached this entity. */
46
apr_size_t entity_version;
47
/* Miscellaneous time values. */
50
apr_time_t request_time;
51
apr_time_t response_time;
56
* Pointed to by cache_object_t::vobj
58
typedef struct disk_cache_object {
59
const char *root; /* the location of the cache directory */
61
char *tempfile; /* temp file tohold the content */
63
const char *datafile; /* name of file where the data will go */
64
const char *hdrsfile; /* name of file where the hdrs will go */
65
const char *hashfile; /* Computed hash key for this URI */
66
const char *name; /* Requested URI without vary bits - suitable for mortals. */
67
const char *key; /* On-disk prefix; URI with Vary bits (if present) */
68
apr_file_t *fd; /* data file */
69
apr_file_t *hfd; /* headers file */
70
apr_file_t *tfd; /* temporary file for data */
71
apr_off_t file_size; /* File size of the cached data file */
72
disk_cache_info_t disk_info; /* Header information. */
73
} disk_cache_object_t;
77
* mod_disk_cache configuration
79
/* TODO: Make defaults OS specific */
80
#define CACHEFILE_LEN 20 /* must be less than HASH_LEN/2 */
81
#define DEFAULT_DIRLEVELS 3
82
#define DEFAULT_DIRLENGTH 2
83
#define DEFAULT_MIN_FILE_SIZE 1
84
#define DEFAULT_MAX_FILE_SIZE 1000000
87
const char* cache_root;
88
apr_size_t cache_root_len;
89
int dirlevels; /* Number of levels of subdirectories */
90
int dirlength; /* Length of subdirectory names */
91
apr_size_t minfs; /* minumum file size for cached files */
92
apr_size_t maxfs; /* maximum file size for cached files */
95
#endif /*MOD_DISK_CACHE_H*/