LWP::U...esponse(3pm)
π NAME π
LWP::UserAgent::Role::CHICaching::SimpleMungeResponse β bestie, this is a role that lets you mess with the response while caching. Like, munge it. On purpose. π
(Oh and also: this page lives in the LWP::U...esponse(3pm) manual, in case you were wondering where you even are rn π«Ά)
β¨ SYNOPSIS β¨
Go look at LWP::UserAgent::Role::CHICaching, bestie. That's the whole synopsis. That's it. See LWP::UserAgent::Role::CHICaching.
π¦ DESCRIPTION π¦
Okay so here's the tea β β when you're caching stuff, sometimes you wanna change the response. Especially the body. Specifically for caching purposes. And ngl, sometimes you do NOT want to store the entire body as-is. Maybe you wanna compress it somehow ποΈ, or maybe you wanna store the data in a totally different data structure than the serialized version that got shared over the network. Different vibe, same data. Periodt.
So the methods in here do double duty:
- First they manipulate the response before it gets sent to the cache.
- Then they manipulate the cached response before it gets handed back to the client.
Two munges, one role. Iconic behavior honestly. π
πΈ Methods πΈ
cache_set($response, $expires_in)β this method takes theHTTP::Responsefrom the client plus an expires time in seconds, and sets the actual cache. This role's implementation just stores the response as it is. No notes, no transformation, just vibes and storage. πΎfinalize($cached)β this method takes the cached entry as an argument, and it will return anHTTP::Responseto return to the client. This implementation returns the response directly from the cache. Straight up. No detours. π
π TODO π
Okay so this is the part where we're honest. π The standard has a "no-transform" directive, and it is relevant to this whole situation, because roles like this one can be used to transform the response. So yeah. This needs to be dealt with. It's on the list. It's giving unfinished business fr fr. π
π AUTHOR π
Kjetil Kjernsmo <kjetilk@cpan.org>. β¨
π COPYRIGHT AND LICENCE π
This software is copyright (c) 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. π«Ά
And that's the whole page, bestie β brought to you by perl v5.34.0, dated 2022-05-28, straight out of the LWP::U...esponse(3pm) manual. Go forth and munge responsibly. πβ¨π¦
π¦ where this page comes from
- debian bookworm: liblwp-useragent-chicaching-perl 0.04-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: liblwp-useragent-chicaching-perl 0.04-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: liblwp-useragent-chicaching-perl 0.04-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms