You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lib...@perl.org
I've just released LWPx-UserAgent-Cached to CPAN and would appreciate
feedback. It's a(nother) subclass of LWP::UserAgent that uses CHI and
Sereal to cache HTTP GET requests, inspired largely by
WWW::Mechanize::Cached but without all the Mech baggage.
I've just released LWPx-UserAgent-Cached to CPAN and would appreciate
feedback.
Good idea. How does it compare against using HTTP::Cache::Transparent with LWP::UserAgent?
LWPx::UserAgent::Cache lets you configure the cache options by using your own cache object, as long as it has a "get" and "set" method. So you can tweak the lifetime of cached responses, or conceivably add logic that looks at the HTTP headers like HTTP::Cache::Transparent does. (In fact that's a really good idea, I think I will add that as a default.)
This also means that you can use other storage methods such as those provided by CHI's various drivers, e.g.: in-memory, file, memory-mapped files, memcached, DBI, BerkeleyDB, Redis…
Lastly, it's a subclass of LWP::UserAgent so you can choose to use it on one user agent and not on another, or have different options for different UAs. HTTP::Cache::Transparent monkeypatches LWP::UserAgent::simple_request, which means that all your UAs get caching whether you want it or not, all using the same cache in the filesystem.