| 1 |
NAME |
| 2 |
LWP::UserAgent::CHICaching - LWP::UserAgent with caching based on CHI |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
The usual way of using LWP::UserAgent, really, just pass a `cache` |
| 6 |
parameter with a CHI object to the constructor: |
| 7 |
|
| 8 |
my $cache = CHI->new( driver => 'Memory', global => 1 ); |
| 9 |
my $ua = LWP::UserAgent::CHICaching->new(cache => $cache); |
| 10 |
my $res1 = $ua->get("http://localhost:3000/?query=DAHUT"); |
| 11 |
|
| 12 |
DESCRIPTION |
| 13 |
This is YA caching user agent. When the client makes a request to the |
| 14 |
server, sometimes the response should be cached, so that no actual request |
| 15 |
has to be sent at all, or possibly just a request to validate the cache. |
| 16 |
HTTP 1.1 defines how to do this. This class simply extends LWP::UserAgent |
| 17 |
with LWP::UserAgent::Role::CHICaching (also in this distribution) which is |
| 18 |
doing the real work to make it possible to use the very flexible CHI |
| 19 |
module to manage such a cache. |
| 20 |
|
| 21 |
But why? Mainly because I wanted to use CHI facilities, and partly because |
| 22 |
I wanted to focus on HTTP 1.1 features. |
| 23 |
|
| 24 |
TODO |
| 25 |
This is an early release, but it supports RFC7234 quite well already. Much |
| 26 |
work remains though. These are the things that I'd like to do: |
| 27 |
|
| 28 |
* Enable smarter generation of keys, so that semantically identical |
| 29 |
content can be cached efficiently even though they may have different |
| 30 |
URIs. This can be done in a separate role with the current code. |
| 31 |
|
| 32 |
* Support all of RFC7234 <http://tools.ietf.org/html/rfc7234> and |
| 33 |
RFC7232 <http://tools.ietf.org/html/rfc7232> |
| 34 |
|
| 35 |
AUTHOR |
| 36 |
Kjetil Kjernsmo <[email protected]>. |
| 37 |
|
| 38 |
COPYRIGHT AND LICENCE |
| 39 |
This software is copyright (c) 2015, 2016 by Kjetil Kjernsmo. |
| 40 |
|
| 41 |
This is free software; you can redistribute it and/or modify it under the |
| 42 |
same terms as the Perl 5 programming language system itself. |
| 43 |
|
| 44 |
DISCLAIMER OF WARRANTIES |
| 45 |
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
| 46 |
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
| 47 |
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 48 |
|