LWP::U...KeyGen(3pm)

πŸ“¦
version 0.04 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble

πŸ’– LWP::UserAgent::Role::CHICaching::SimpleKeyGen πŸ’–

okay so this is LWP::UserAgent::Role::CHICaching::SimpleKeyGen from the Perl docs, bestie, and it's literally the simplest little role for making cache keys when you're caching LWP::UserAgent πŸŽ€ she's not complicated, she's not doing too much, and honestly? that's her whole vibe ✨


✨ SYNOPSIS ✨

go look at LWP::UserAgent::Role::CHICaching for the deets, bestie, that's where the actual story is πŸ’…


🌸 DESCRIPTION 🌸

so LWP::UserAgent::Role::CHICaching is a role for building caching user agents, right? and there's this whole thing where caching the same resource in different variants gets messy β€” like, same content but in different natural languages, or different serializations. Section 4.1 of RFC7234 is where all that drama lives:

http://tools.ietf.org/html/rfc7234#section-4.1

and the way this role handles that whole mess is… the dumbest way possible πŸ™ˆ like, no cap, the official approach here is: just don't cache anything when the problem shows up. problem solved, queen πŸ’€

but listen, if you actually wanna solve it properly, you'd generate a cache key based on the URI and the content β€” like "Content-Language: en" for example β€” and then you'd provide a better implementation of the key attribute. and then, and then, you'd also need to tell the system when it's chill to cache something with a Vary header, by making the cache_vary method smarter. if you want to see what an alternative looks like, peep LWP::UserAgent::Role::CHICaching::VaryNotAsterisk πŸ‘‘

πŸ¦‹ Attributes and Methods πŸ¦‹

  • key, clear_key β€” the key to use for a response. this role just returns the canonical URI of the request as a string, and honestly that's a perfectly reasonable default, periodt 🫢
  • cache_vary β€” will never allow a response with a Vary header to be cached. like, not ever. that's the rule. no exceptions, no negotiations πŸ’…

⭐ AUTHOR ⭐

Kjetil Kjernsmo <kjetilk@cpan.org>. iconic behavior, we love a credited author πŸ’œ


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. so go wild, bestie, it's yours 🌈


okay that's the whole page!! πŸŽ€ and before you go β€” the footer energy: this is perl v5.34.0, dated 2022-05-28, part of the User Contributed Perl Documentation, and the page name is LWP::U...KeyGen(3pm) πŸ’– slay, bye bestie!! πŸ¦‹βœ¨

πŸ“¦ where this page comes from