logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

LWP::UserAgent::Role::CHICaching::SimpleKeyGen - A role for cache keys when caching LWP::UserAgent

Author

       Kjetil Kjernsmo <kjetilk@cpan.org>.

Description

       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
       <http://tools.ietf.org/html/rfc7234#section-4.1> 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.

   AttributesandMethods
       "key", "clear_key"
           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.

       "cache_vary"
           Will never allow a response with a "Vary" header to be cached.

Name

       LWP::UserAgent::Role::CHICaching::SimpleKeyGen - A role for cache keys when caching LWP::UserAgent

Synopsis

       See LWP::UserAgent::Role::CHICaching.

See Also