-
Notifications
You must be signed in to change notification settings - Fork 1
/
wmpage_cache.install
79 lines (75 loc) · 2.31 KB
/
wmpage_cache.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* Implements hook_schema()
*/
function wmpage_cache_schema()
{
$schema['wmpage_cache'] = [
'description' => 'Stores cacheable responses',
'fields' => [
'id' => [
'description' => 'A sha1 of request params',
'type' => 'char',
'length' => 40,
'not null' => true,
],
'method' => [
'type' => 'varchar_ascii',
'length' => 20,
'not null' => true,
],
'uri' => [
'description' => 'The request uri',
'type' => 'text',
'size' => 'normal', // 64KiB
'not null' => true,
],
'headers' => [
'description' => 'The response headers',
'type' => 'text',
'size' => 'normal', // 64KiB, should be plenty
'not null' => true,
],
'content' => [
'description' => 'The response body',
'type' => 'blob',
'size' => 'big', // 4GiB
'not null' => false,
],
'expiry' => [
'description' => 'The time at which this entry becomes stale',
'type' => 'int',
'unsigned' => true, // We wont handle expiries < 01/01/1970
'not null' => true,
'size' => 'normal', // Will fail after 2106, next generation's problem.
],
],
'primary key' => ['id'],
'indexes' => [
'expiry' => ['expiry'],
],
];
$schema['wmpage_cache_tags'] = [
'description' => 'Stores tags attached to wmpage_cache entries',
'fields' => [
'id' => [
'description' => 'A sha1 of request params',
'type' => 'char',
'length' => 40,
'not null' => true,
],
'tag' => [
'type' => 'varchar_ascii',
'length' => 255,
'not null' => true,
],
],
'primary key' => ['id', 'tag'],
'indexes' => ['id' => ['id'], 'tag' => ['tag']],
];
return $schema;
}
function wmpage_cache_update_8001(): void
{
drupal_install_schema('wmpage_cache');
}