LWP::UserAgent::Role::CHICaching(3pm) | User Contributed Perl Documentation | LWP::UserAgent::Role::CHICaching(3pm) |
LWP::UserAgent::Role::CHICaching - A role to allow LWP::UserAgent to cache with CHI
Compose it into a class, e.g.
package LWP::UserAgent::MyCacher; use Moo; extends 'LWP::UserAgent'; with 'LWP::UserAgent::Role::CHICaching', 'LWP::UserAgent::Role::CHICaching::SimpleKeyGen', 'LWP::UserAgent::Role::CHICaching::SimpleMungeResponse';
This is a role for creating caching user agents. 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 role makes it possible to use the very flexible CHI module to manage such a cache. See LWP::UserAgent::CHICaching for a finished class you can use.
The following are required by this role, but implemented elsewhere. See LWP::UserAgent::Role::CHICaching::SimpleKeyGen and LWP::UserAgent::Role::CHICaching::SimpleMungeResponse for further explanations.
Will only cache "GET" requests, and only successful responses.
The module does not validate and does not serve stale responses, even when it would be allowed to do so. It nevertheless does most of RFC7234.
Please report any bugs to <https://github.com/kjetilk/p5-lwp-useragent-chicaching/issues>.
Kjetil Kjernsmo <kjetilk@cpan.org>.
It was really nice looking at the code of LWP::UserAgent::WithCache, when I wrote this.
Thanks to Matt S. Trout for rewriting this to a Role.
This software is copyright (c) 2015, 2016 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.
2022-05-28 | perl v5.34.0 |