{"id":15018385,"url":"https://github.com/kianmeng/role-cache-lru","last_synced_at":"2026-04-03T10:37:52.361Z","repository":{"id":56837707,"uuid":"169735146","full_name":"kianmeng/role-cache-lru","owner":"kianmeng","description":"Cache::LRU role for Moo related classes","archived":false,"fork":false,"pushed_at":"2019-05-04T02:19:42.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-13T00:42:18.364Z","etag":null,"topics":["cache","lru","moo","perl"],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kianmeng.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-08T12:56:40.000Z","updated_at":"2019-05-26T15:59:09.000Z","dependencies_parsed_at":"2022-09-12T11:51:17.566Z","dependency_job_id":null,"html_url":"https://github.com/kianmeng/role-cache-lru","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/kianmeng/role-cache-lru","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kianmeng%2Frole-cache-lru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kianmeng%2Frole-cache-lru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kianmeng%2Frole-cache-lru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kianmeng%2Frole-cache-lru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kianmeng","download_url":"https://codeload.github.com/kianmeng/role-cache-lru/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kianmeng%2Frole-cache-lru/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28053360,"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","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cache","lru","moo","perl"],"created_at":"2024-09-24T19:51:54.352Z","updated_at":"2025-12-26T11:00:59.521Z","avatar_url":"https://github.com/kianmeng.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Cpan license](https://img.shields.io/cpan/l/Role-Cache-LRU.svg)](https://metacpan.org/release/Role-Cache-LRU)\n[![Cpan version](https://img.shields.io/cpan/v/Role-Cache-LRU.svg)](https://metacpan.org/release/Role-Cache-LRU)\n\n# NAME\n\nRole::Cache::LRU - LRU caching role for Moo class.\n\n# SYNOPSIS\n\n    package MyPackage;\n\n    use Moo;\n    with 'Role::Cache::LRU';\n\n    my $mp = MyPackage-\u003enew;\n    $mp-\u003eset_cache('foo', {bar =\u003e 1});\n    $mp-\u003eget_cache('foo');\n\n# DESCRIPTION\n\nRole::Cache::LRU is a Moo's role that provides LRU caching based on\n[Cache::LRU](https://metacpan.org/pod/Cache::LRU).\n\n# DEVELOPMENT\n\nSource repository at [https://github.com/kianmeng/role-cache-lru](https://github.com/kianmeng/role-cache-lru).\n\nHow to contribute? Follow through the [CONTRIBUTING.md](https://github.com/kianmeng/role-cache-lru/blob/master/CONTRIBUTING.md) document to setup your development environment.\n\n# METHODS\n\n## set\\_cache($key, $item)\n\nAdd a cache item to the cache. The $key must be a string.\n\n    my $mp = MyPackage-\u003enew;\n    $mp-\u003eset_cache('foo', {bar =\u003e 1});\n    $mp-\u003eset_cache('bar', [1, 2, 3]);\n\n## get\\_cache($key)\n\nGet a cached item based on the $key. If nothing is found, returns undef.\n\n    my $mp = MyPackage-\u003enew;\n    my $item = $mp-\u003eget_cache('fishball');\n    print $item; # undef\n\n## set\\_cache\\_size($max)\n\nSet the maximum cached size. The $max value must be larger or equal to 1.\nAdjust this to your available maximum memory in your script.\n\n    my $mp = MyPackage-\u003enew;\n    $mp-\u003eset_cache_size(4096);\n\n## get\\_cache\\_size()\n\nGet the maximum cache size. The default maximum value is 1024.\n\n    my $mp = MyPackage-\u003enew;\n    print $mp-\u003eget_cache_size();\n    # 1024\n\n# AUTHOR\n\nKian Meng, Ang \u003ckianmeng@cpan.org\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is Copyright (c) 2019 Kian Meng, Ang.\n\nThis is free software, licensed under:\n\n    The Artistic License 2.0 (GPL Compatible)\n\n# SEE ALSO\n\n[Cache::LRU](https://metacpan.org/pod/Cache::LRU)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkianmeng%2Frole-cache-lru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkianmeng%2Frole-cache-lru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkianmeng%2Frole-cache-lru/lists"}