On Thu, Feb 12, 2015 at 3:24 PM, Nigel Horne <n...@bandsman.co.uk> wrote:
> 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. Hope this helps!