NAME
    HTTP::Tiny::Patch::Cache - Cache HTTP::Tiny responses

VERSION
    This document describes version 0.002 of HTTP::Tiny::Patch::Cache (from
    Perl distribution HTTP-Tiny-Patch-Cache), released on 2018-09-20.

SYNOPSIS
    From Perl:

     use HTTP::Tiny::Patch::Cache;

     my $res  = HTTP::Tiny->new->get("http://www.example.com/");
     my $res2 = HTTP::Tiny->request(GET => "http://www.example.com/"); # cached response

    From command-line (one-liner):

     % perl -MHTTP::Tiny::Patch::Cache -E'my $res = HTTP::Tiny->new->get("..."); ...'

    To customize cache period (default is one day, the example below sets it
    to 2 hours):

     % CACHE_MAX_AGE=7200 perl -MHTTP::Tiny::Patch::Cache ...

    To clear cache, you can temporarily set cache period to 0:

     % CACHE_MAX_AGE=0 perl -MHTTP::Tiny::Patch::Cache ...

    Or you can delete *$tempdir/http_tiny_patch_cache/*, where *$tempdir* is
    retrieved from File::Util::Tempdir's "get_user_tempdir()".

DESCRIPTION
    This module patches HTTP::Tiny to cache responses. Currently only GET
    requests are cached. Cache are keyed by SHA256-hex(URL). Error responses
    are also cached. Currently no cache-related HTTP request or response
    headers (e.g. "Cache-Control") are respected. This patch is mostly
    useful when testing (e.g. saving bandwidth when repeatedly getting huge
    HTTP pages).

CONFIGURATION
FAQ
ENVIRONMENT
  CACHE_MAX_AGE
    Int. Default 86400. Set period of cache.

HOMEPAGE
    Please visit the project's homepage at
    <https://metacpan.org/release/HTTP-Tiny-Patch-Cache>.

SOURCE
    Source repository is at
    <https://github.com/perlancar/perl-HTTP-Tiny-Patch-Cache>.

BUGS
    Please report any bugs or feature requests on the bugtracker website
    <https://rt.cpan.org/Public/Dist/Display.html?Name=HTTP-Tiny-Patch-Cache
    >

    When submitting a bug or request, please include a test-file or a patch
    to an existing test-file that illustrates the bug or desired feature.

SEE ALSO
    LWP::Simple::WithCache

    LWP::UserAgent::WithCache

    MooX::Role::CachedURL

AUTHOR
    perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2018 by perlancar@cpan.org.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

