{"id":15286172,"url":"https://github.com/mjgardner/lwpx-useragent-cached","last_synced_at":"2026-02-02T17:12:39.784Z","repository":{"id":27131655,"uuid":"30600154","full_name":"mjgardner/LWPx-UserAgent-Cached","owner":"mjgardner","description":"Subclass of LWP::UserAgent that caches HTTP GET requests","archived":false,"fork":false,"pushed_at":"2020-10-19T01:59:27.000Z","size":89,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-10T04:50:00.196Z","etag":null,"topics":["perl"],"latest_commit_sha":null,"homepage":"http://metacpan.org/release/LWPx-UserAgent-Cached/","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mjgardner.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-10T15:59:01.000Z","updated_at":"2023-03-17T12:04:01.000Z","dependencies_parsed_at":"2022-08-28T20:10:44.526Z","dependency_job_id":null,"html_url":"https://github.com/mjgardner/LWPx-UserAgent-Cached","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/mjgardner/LWPx-UserAgent-Cached","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjgardner%2FLWPx-UserAgent-Cached","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjgardner%2FLWPx-UserAgent-Cached/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjgardner%2FLWPx-UserAgent-Cached/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjgardner%2FLWPx-UserAgent-Cached/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mjgardner","download_url":"https://codeload.github.com/mjgardner/LWPx-UserAgent-Cached/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjgardner%2FLWPx-UserAgent-Cached/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259786372,"owners_count":22910934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["perl"],"created_at":"2024-09-30T15:10:50.881Z","updated_at":"2026-02-02T17:12:39.740Z","avatar_url":"https://github.com/mjgardner.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nLWPx::UserAgent::Cached - Subclass of LWP::UserAgent that caches HTTP GET requests\n\n# VERSION\n\nversion 0.011\n\n# SYNOPSIS\n\n    use LWPx::UserAgent::Cached;\n    use CHI;\n\n    my $ua = LWPx::UserAgent::Cached-\u003enew(\n        cache =\u003e CHI-\u003enew(\n            driver =\u003e 'File', root_dir =\u003e '/tmp/cache', expires_in =\u003e '1d',\n        ),\n    );\n    $ua-\u003eget('http://www.perl.org/');\n\n# DESCRIPTION\n\nThis module borrows the caching logic from\n[`WWW::Mechanize::Cached`](https://metacpan.org/pod/WWW%3A%3AMechanize%3A%3ACached) but\nwithout inheriting from\n[`WWW::Mechanize`](https://metacpan.org/pod/WWW%3A%3AMechanize); instead it is just\na direct subclass of\n[`LWP::UserAgent`](https://metacpan.org/pod/LWP%3A%3AUserAgent).\n\n## HTTP/1.1 cache operation\n\nFull HTTP/1.1 cache compliance is a work in progress. As of version 0.006 we\nhave limited support for HTTP/1.1 `ETag`/`If-None-Match` headers, as well as\n`no-cache` and `no-store` `Cache-Control` directives (both on request and\nresponse) and the `Pragma: no-cache` request header.\n\n# ATTRIBUTES\n\n## cache\n\nSettable at construction, defaults to using\n[`CHI::Driver::RawMemory`](https://metacpan.org/pod/CHI%3A%3ADriver%3A%3ARawMemory) with\nan instance-specific hash datastore and a namespace with the current\npackage name. You can use your own caching object here as long as it has\n`get` and `set` methods.\n\n## is\\_cached\n\nRead-only accessor that indicates if the current request is cached or not.\n\n## cache\\_undef\\_content\\_length\n\nSettable at construction or anytime thereafter, indicates whether we should\ncache content even if the HTTP `Content-Length` header is missing or\nundefined. Defaults to false.\n\n## cache\\_zero\\_content\\_length\n\nSettable at construction or anytime thereafter, indicates whether we should\ncache content even if the HTTP `Content-Length` header is zero. Defaults to\nfalse.\n\n## cache\\_mismatch\\_content\\_length\n\nSettable at construction or anytime thereafter, indicates whether we should\ncache content even if the length of the data does not match the HTTP\n`Content-Length` header. Defaults to true.\n\n## ref\\_in\\_cache\\_key\n\nSettable at construction or anytime thereafter, indicates whether we should\nstore the HTTP referrer in the cache key. Defaults to false.\n\n## positive\\_cache\n\nSettable at construction or anytime thereafter, indicates whether we should\nonly cache positive responses (HTTP response codes from `200` to `300`\ninclusive) or cache everything. Defaults to true.\n\n## ignore\\_headers\n\nSettable at construction or anytime thereafter, indicates whether we should\nignore `Cache-Control: no-cache`, `Cache-Control: no-store`, and\n`Pragma: no-cache` HTTP headers when deciding whether to cache a response.\nDefaults to false.\n\n**Important note:** This option is potentially dangerous, as it ignores the\nexplicit instructions from the server and thus can lead to returning stale\ncontent.\n\n# REQUIRES\n\n- [CHI](https://metacpan.org/pod/CHI)\n- [HTTP::Status](https://metacpan.org/pod/HTTP%3A%3AStatus)\n- [Moo](https://metacpan.org/pod/Moo)\n- [Types::Standard](https://metacpan.org/pod/Types%3A%3AStandard)\n- [namespace::clean](https://metacpan.org/pod/namespace%3A%3Aclean)\n\n# SEE ALSO\n\n- [`LWP::UserAgent`](https://metacpan.org/pod/LWP%3A%3AUserAgent)\n\n    Parent of this class.\n\n- [`WWW::Mechanize::Cached`](https://metacpan.org/pod/WWW%3A%3AMechanize%3A%3ACached)\n\n    Inspiration for this class.\n\n# HANDLERS\n\nThis module works by adding `request_send`, `response_done` and\n`response_header` [handlers](https://metacpan.org/pod/LWP%3A%3AUserAgent#Handlers)\nthat run on successful HTTP `GET` requests.\nIf you need to modify or remove these handlers you may use LWP::UserAgent's\n[handler-related methods](https://metacpan.org/pod/LWP%3A%3AUserAgent#Handlers).\n\n# SUPPORT\n\n## Perldoc\n\nYou can find documentation for this module with the perldoc command.\n\n    perldoc LWPx::UserAgent::Cached\n\n## Websites\n\nThe following websites have more information about this module, and may be of help to you. As always,\nin addition to those websites please use your favorite search engine to discover more resources.\n\n- MetaCPAN\n\n    A modern, open-source CPAN search engine, useful to view POD in HTML format.\n\n    [https://metacpan.org/release/LWPx-UserAgent-Cached](https://metacpan.org/release/LWPx-UserAgent-Cached)\n\n- CPANTS\n\n    The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.\n\n    [http://cpants.cpanauthors.org/dist/LWPx-UserAgent-Cached](http://cpants.cpanauthors.org/dist/LWPx-UserAgent-Cached)\n\n- CPAN Testers\n\n    The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.\n\n    [http://www.cpantesters.org/distro/L/LWPx-UserAgent-Cached](http://www.cpantesters.org/distro/L/LWPx-UserAgent-Cached)\n\n- CPAN Testers Matrix\n\n    The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.\n\n    [http://matrix.cpantesters.org/?dist=LWPx-UserAgent-Cached](http://matrix.cpantesters.org/?dist=LWPx-UserAgent-Cached)\n\n- CPAN Testers Dependencies\n\n    The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.\n\n    [http://deps.cpantesters.org/?module=LWPx::UserAgent::Cached](http://deps.cpantesters.org/?module=LWPx::UserAgent::Cached)\n\n## Bugs / Feature Requests\n\nPlease report any bugs or feature requests through the web\ninterface at\n[https://github.com/mjgardner/LWPx-UserAgent-Cached/issues](https://github.com/mjgardner/LWPx-UserAgent-Cached/issues).\nYou will be automatically notified of any progress on the\nrequest by the system.\n\n## Source Code\n\nThe code is open to the world, and available for you to hack on. Please feel free to browse it and play\nwith it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull\nfrom your repository :)\n\n[https://github.com/mjgardner/LWPx-UserAgent-Cached](https://github.com/mjgardner/LWPx-UserAgent-Cached)\n\n    git clone git://github.com/mjgardner/LWPx-UserAgent-Cached.git\n\n# AUTHOR\n\nMark Gardner \u003cmjgardner@cpan.org\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2020 by ZipRecruiter.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjgardner%2Flwpx-useragent-cached","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmjgardner%2Flwpx-useragent-cached","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjgardner%2Flwpx-useragent-cached/lists"}