NAME

LWP::UserAgent::Caching - HTTP::Casing based UserAgent, finally done right

SYNOPSIS

use LWP::UserAgent::Caching;

my $ua = LWP::UserAgent::Caching->new(
    cache           => {
        driver          => 'File',
        root_dir        => '/tmp/LWP_UserAgent_Caching',
        file_extension  => '.cache',
    },
    cache_meta      => {
        driver          => 'File',
        root_dir        => '/tmp/LWP_UserAgent_Caching',
        file_extension  => '.cache',
        l1_cache        => {
            driver          => 'Memory',
            global          => 1,
            max_size        => 1024*1024
        }
    },
    cache_type      => 'private',
    cache_control   => (
        'max-age=86400',            # 24hrs
        'min-fresh=60',             # not over due within the next minute
    )
);

my $rqst = HTTP::Request->new( GET => 'http://example.com' );

$rqst->header( cache_control => 'no-cache' ); # Oh... now we bypass it ?
$rqst->header( accept_language => 'nl, en-GB; q=0.9, en; 0.8, *' ); 

my $resp = $ua->request($rqst);

DESCRIPTION

LWP::UserAgent::Caching gives you RFC compliant caching. It respects the old HTTP/1 headerfields like 'Expires' but also implements the HTTP/1.1 'Cache-Control' directives.

Unlike many other cachng useragents, this one does actually invalidate the cache after a non-error response returned by a non-safe request (like DELETE).

METHODS

Since it's a subclass of the standard LWP::UserAgent, it inherrits all those. In this module we also implemented the shortcuts from HTTP::Request::Common so that tehy will not call the parrent class

SEE ALSO

HTTP::Caching The RFC 7234 compliant brains - DO NEVER USE THAT MODULE DIRECTLY