Puppet Class: apache::mod::disk_cache

Defined in:
manifests/mod/disk_cache.pp

Summary

Installs and configures `mod_disk_cache`.

Overview

Note:

Apache 2.2, mod_disk_cache installed. On Apache 2.4, mod_cache_disk installed.

Parameters:

  • cache_root (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    Defines the name of the directory on the disk to contain cache files. Default depends on the Apache version and operating system:

    • Debian: /var/cache/apache2/mod_cache_disk

    • FreeBSD: /var/cache/mod_cache_disk

    • Red Hat, Apache 2.4: /var/cache/httpd/proxy

    • Red Hat, Apache 2.2: /var/cache/mod_proxy

  • cache_ignore_headers (Optional[String]) (defaults to: undef)

    Specifies HTTP header(s) that should not be stored in the cache.

  • default_cache_enable (Boolean) (defaults to: true)

    Default value is true, which enables “CacheEnable disk /” in disk_cache.conf for the webserver. This would cache every request to apache by default for every vhost. If set to false the default cache all behaviour is supressed. You can then control this behaviour in individual vhosts by explicitly defining CacheEnable.

See Also:



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
# File 'manifests/mod/disk_cache.pp', line 25

class apache::mod::disk_cache (
  Optional[Stdlib::Absolutepath] $cache_root = undef,
  Optional[String] $cache_ignore_headers     = undef,
  Boolean $default_cache_enable              = true,
) {
  include apache
  if $cache_root {
    $_cache_root = $cache_root
  }
  elsif versioncmp($apache::apache_version, '2.4') >= 0 {
    $_cache_root = $facts['os']['family'] ? {
      'debian'  => '/var/cache/apache2/mod_cache_disk',
      'redhat'  => '/var/cache/httpd/proxy',
      'freebsd' => '/var/cache/mod_cache_disk',
    }
  }
  else {
    $_cache_root = $facts['os']['family'] ? {
      'debian'  => '/var/cache/apache2/mod_disk_cache',
      'redhat'  => '/var/cache/mod_proxy',
      'freebsd' => '/var/cache/mod_disk_cache',
    }
  }

  if versioncmp($apache::apache_version, '2.4') >= 0 {
    apache::mod { 'cache_disk': }
  }
  else {
    apache::mod { 'disk_cache': }
  }

  Class['apache::mod::cache'] -> Class['apache::mod::disk_cache']

  # Template uses $_cache_root
  file { 'disk_cache.conf':
    ensure  => file,
    path    => "${apache::mod_dir}/disk_cache.conf",
    mode    => $apache::file_mode,
    content => template('apache/mod/disk_cache.conf.erb'),
    require => Exec["mkdir ${apache::mod_dir}"],
    before  => File[$apache::mod_dir],
    notify  => Class['apache::service'],
  }
}