Puppet Class: apache::mod::cache_disk

Defined in:
manifests/mod/cache_disk.pp

Summary

Installs and configures `mod_cache_disk`.

Overview

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: /var/cache/httpd/proxy

  • cache_enable (Array[String]) (defaults to: [])

    Defines an array of directories to cache, the default is none

  • cache_dir_length (Optional[Integer]) (defaults to: undef)

    The number of characters in subdirectory names

  • cache_dir_levels (Optional[Integer]) (defaults to: undef)

    The number of levels of subdirectories in the cache.

  • cache_max_filesize (Optional[Integer]) (defaults to: undef)

    The maximum size (in bytes) of a document to be placed in the cache

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

    DEPRECATED Ignore request to not serve cached content to client (included for compatibility reasons to support disk_cache)

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

    DEPRECATED Name of module configuration file (used for the compatibility layer for disk_cache)

See Also:



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
80
81
82
83
84
85
# File 'manifests/mod/cache_disk.pp', line 36

class apache::mod::cache_disk (
  Optional[Stdlib::Absolutepath] $cache_root              = undef,
  Array[String] $cache_enable               = [],
  Optional[Integer] $cache_dir_length       = undef,
  Optional[Integer] $cache_dir_levels       = undef,
  Optional[Integer] $cache_max_filesize     = undef,
  Optional[String] $cache_ignore_headers    = undef,
  Optional[String] $configuration_file_name = undef,
) {
  include apache

  if $cache_ignore_headers {
    deprecation(
      'apache::mod::cache_disk',
      'The parameter cache_ignore_headers is deprecated. Please use apache::mod::cache::cache_ignore_headers instead.'
    )
  }

  $_cache_root = $cache_root ? {
    undef   => $facts['os']['family'] ? {
      'debian'  => '/var/cache/apache2/mod_cache_disk',
      'redhat'  => '/var/cache/httpd/proxy',
      'freebsd' => '/var/cache/mod_cache_disk',
    },
    default => $cache_root,
  }
  $_configuration_file_name = pick($configuration_file_name, 'cache_disk.conf')
  $_class_name = 'apache::mod::cache_disk'

  apache::mod { 'cache_disk': }

  Class['apache::mod::cache'] -> Class[$_class_name]

  file { $_configuration_file_name:
    ensure  => file,
    path    => "${apache::mod_dir}/${_configuration_file_name}",
    mode    => $apache::file_mode,
    content => epp('apache/mod/cache_disk.conf.epp', {
        cache_root           => $_cache_root,
        cache_enable         => $cache_enable,
        cache_dir_length     => $cache_dir_length,
        cache_dir_levels     => $cache_dir_levels,
        cache_max_filesize   => $cache_max_filesize,
        cache_ignore_headers => $cache_ignore_headers,
    }),
    require => Exec["mkdir ${apache::mod_dir}"],
    before  => File[$apache::mod_dir],
    notify  => Class['apache::service'],
  }
}