NAME
    LWP::UserAgent::CHICaching - LWP::UserAgent with caching based on CHI

SYNOPSIS
    The usual way of using LWP::UserAgent, really, just pass a `cache`
    parameter with a CHI object to the constructor:

      my $cache = CHI->new( driver => 'Memory', global => 1 );
      my $ua = LWP::UserAgent::CHICaching->new(cache => $cache);
      my $res1 = $ua->get("http://localhost:3000/?query=DAHUT");

DESCRIPTION
    This is YA caching user agent. When the client makes a request to the
    server, sometimes the response should be cached, so that no actual request
    has to be sent at all, or possibly just a request to validate the cache.
    HTTP 1.1 defines how to do this. This module makes it possible to use the
    very flexible CHI module to manage such a cache.

    But why? Mainly because I wanted to use CHI facilities, and partly because
    I wanted to focus on HTTP 1.1 features.

  Attributes and Methods
    `cache`
        Used to set the `CHI` object to be used as cache in the constructor.

    `key`, `clear_key`
        The key to use for a response. Defaults to the canonical URI of the
        request. May make sense to set differently in the future, but should
        probably be left alone for now.

    `request_uri`
        The Request-URI of the request. When set, it will clear the `key`, but
        should probably be left to be used internally for now.

    `request`
        Overriding LWP::UserAgent's request method.

LIMITATIONS
    Will only cache `GET` requests and only looks at the `Cache-Control:
    max-age` header. Does not make any attempts to see if the response is
    invalid.

BUGS
    Please report any bugs to
    <https://github.com/kjetilk/p5-lwp-useragent-chicaching/issues>.

TODO
    This is a very early release, meant just for the author's immediate needs.
    These are the things that I'd like to do:

    *   Enable smarter generation of keys, so that semantically identical
        content can be cached efficiently even though they may have different
        URIs.

    *   Support all of RFC7234 <http://tools.ietf.org/html/rfc7234> and
        <RFC7232|http://tools.ietf.org/html/rfc7232>

AUTHOR
    Kjetil Kjernsmo <kjetilk@cpan.org>.

ACKNOWLEDGEMENTS
    It was really nice looking at the code of LWP::UserAgent::WithCache, when
    I wrote this.

COPYRIGHT AND LICENCE
    This software is copyright (c) 2015 by Kjetil Kjernsmo.

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

DISCLAIMER OF WARRANTIES
    THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
    WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
    MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

