about summary refs log tree commit diff
path: root/README
blob: 54e00e473c81bab10e3b74ab9c7e1914c6575757 (plain) (blame)
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
NAME
    Plack::Middleware::ETag - Adds automatically an ETag header.

SYNOPSIS
      use Plack::Builder;

      my $app = builder {
        enable "Plack::Middleware::ETag", file_etag => [qw/inode mtime size/];
        sub {['200', ['Content-Type' => 'text/html'}, ['hello world']]};
      };

DESCRIPTION
    Plack::Middleware::ETag adds automatically an ETag header. You may want
    to use it with "Plack::Middleware::ConditionalGET".

      my $app = builder {
        enable "Plack::Middleware::ConditionalGET";
        enable "Plack::Middleware::ETag", file_etag => "inode";
        sub {['200', ['Content-Type' => 'text/html'}, ['hello world']]};
      };

  CONFIGURATION
    file_etag
        If the content is a file handle, the ETag will be set using the
        inode, modified time and the file size. You can select which
        attributes of the file will be used to set the ETag:

            enable "Plack::Middleware::ETag", file_etag => [qw/size/];

    cache_control
        It's possible to add 'Cache-Control' header.

            enable "Plack::Middleware::ETag", cache_control => 1;

        Will add "Cache-Control: must-revalidate" to the headers.

            enable "Plack::Middleware::ETag", cache_control => [ 'must-revalidate', 'max-age=3600' ];

        Will add "Cache-Control: must-revalidate, max-age=3600" to the
        headers.

AUTHOR
    franck cuny <franck@lumberjaph.net>

SEE ALSO
LICENSE
    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.