Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mod_cache_disk.h
Go to the documentation of this file.
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 
17 #ifndef MOD_CACHE_DISK_H
18 #define MOD_CACHE_DISK_H
19 
20 #include "apr_file_io.h"
21 
22 #include "cache_disk_common.h"
23 
24 /*
25  * include for mod_cache_disk: Disk Based HTTP 1.1 Cache.
26  */
27 
28 typedef struct {
30  const char *file;
32  char *tempfile;
35 
36 /*
37  * disk_cache_object_t
38  * Pointed to by cache_object_t::vobj
39  */
40 typedef struct disk_cache_object {
41  const char *root; /* the location of the cache directory */
43  const char *prefix;
44  disk_cache_file_t data; /* data file structure */
45  disk_cache_file_t hdrs; /* headers file structure */
46  disk_cache_file_t vary; /* vary file structure */
47  const char *hashfile; /* Computed hash key for this URI */
48  const char *name; /* Requested URI without vary bits - suitable for mortals. */
49  const char *key; /* On-disk prefix; URI with Vary bits (if present) */
50  apr_off_t file_size; /* File size of the cached data file */
51  disk_cache_info_t disk_info; /* Header information. */
52  apr_table_t *headers_in; /* Input headers to save */
53  apr_table_t *headers_out; /* Output headers to save */
54  apr_off_t offset; /* Max size to set aside */
55  apr_time_t timeout; /* Max time to set aside */
56  unsigned int done:1; /* Is the attempt to cache complete? */
58 
59 
60 /*
61  * mod_cache_disk configuration
62  */
63 /* TODO: Make defaults OS specific */
64 #define CACHEFILE_LEN 20 /* must be less than HASH_LEN/2 */
65 #define DEFAULT_DIRLEVELS 2
66 #define DEFAULT_DIRLENGTH 2
67 #define DEFAULT_MIN_FILE_SIZE 1
68 #define DEFAULT_MAX_FILE_SIZE 1000000
69 #define DEFAULT_READSIZE 0
70 #define DEFAULT_READTIME 0
71 
72 typedef struct {
73  const char* cache_root;
75  int dirlevels; /* Number of levels of subdirectories */
76  int dirlength; /* Length of subdirectory names */
78 
79 typedef struct {
80  apr_off_t minfs; /* minimum file size for cached files */
81  apr_off_t maxfs; /* maximum file size for cached files */
82  apr_off_t readsize; /* maximum data to attempt to cache in one go */
83  apr_time_t readtime; /* maximum time taken to cache in one go */
84  unsigned int minfs_set:1;
85  unsigned int maxfs_set:1;
86  unsigned int readsize_set:1;
87  unsigned int readtime_set:1;
89 
90 #endif /*MOD_CACHE_DISK_H*/
91 
size_t apr_size_t
Definition: apr.h:375
const char * name
Definition: mod_cache_disk.h:48
apr_time_t readtime
Definition: mod_cache_disk.h:83
Definition: apr_arch_file_io.h:107
const char * cache_root
Definition: mod_cache_disk.h:73
Definition: mod_cache_disk.h:79
apr_off_t minfs
Definition: mod_cache_disk.h:80
int dirlength
Definition: mod_cache_disk.h:76
apr_table_t * headers_in
Definition: mod_cache_disk.h:52
Definition: cache_disk_common.h:43
apr_off_t file_size
Definition: mod_cache_disk.h:50
APR File I/O Handling.
Definition: mod_cache_disk.h:28
const char * prefix
Definition: mod_cache_disk.h:43
apr_int64_t apr_time_t
Definition: apr_time.h:45
apr_off_t readsize
Definition: mod_cache_disk.h:82
apr_off_t maxfs
Definition: mod_cache_disk.h:81
disk_cache_file_t hdrs
Definition: mod_cache_disk.h:45
apr_size_t cache_root_len
Definition: mod_cache_disk.h:74
const char * hashfile
Definition: mod_cache_disk.h:47
apr_off_t offset
Definition: mod_cache_disk.h:54
struct disk_cache_object disk_cache_object_t
apr_file_t * fd
Definition: mod_cache_disk.h:31
Common Disk Cache vars/structs.
const char * file
Definition: mod_cache_disk.h:30
Definition: mod_cache_disk.h:40
const char * key
Definition: mod_cache_disk.h:49
unsigned int done
Definition: mod_cache_disk.h:56
disk_cache_info_t disk_info
Definition: mod_cache_disk.h:51
struct apr_table_t apr_table_t
Definition: apr_tables.h:56
char * tempfile
Definition: mod_cache_disk.h:32
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
Definition: mod_cache_disk.h:72
apr_file_t * tempfd
Definition: mod_cache_disk.h:33
apr_table_t * headers_out
Definition: mod_cache_disk.h:53
apr_pool_t * pool
Definition: mod_cache_disk.h:29
apr_time_t timeout
Definition: mod_cache_disk.h:55
disk_cache_file_t data
Definition: mod_cache_disk.h:44
off_t apr_off_t
Definition: apr.h:377
const char * root
Definition: mod_cache_disk.h:41
apr_size_t root_len
Definition: mod_cache_disk.h:42
disk_cache_file_t vary
Definition: mod_cache_disk.h:46
int dirlevels
Definition: mod_cache_disk.h:75