LWP::UserAgent::Role::CHICaching::SimpleKeyGen - A role for cache keys when caching LWP::UserAgent
LWP::UserAgent::Role::CHICaching is a role for creating caching user agents. There's some complexity around caching different variants of the same resource (e.g. the same thing in different natural languages, different serializations that is considered in Section 4.1 of RFC7234 that this role is factored out to address in the dumbest way possible: Just don't cache when the problem arises.
To really solve this problem in a better way, you need to generate a cache key based on not only the URI, but also on the content (e.g.
Content-Language: en), and so, provide a better implementation of the
key attribute, and then, you also need to tell the system when it is OK to cache something with a
Vary header by making the
cache_vary method smarter. See LWP::UserAgent::Role::CHICaching::VaryNotAsterisk for an example of an alternative.
The key to use for a response. This role will return the canonical URI of the request as a string, which is a reasonable default.
Will never allow a response with a
Varyheader to be cached.
Kjetil Kjernsmo <email@example.com>.
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.