{"id":21544326,"url":"https://github.com/railken/cacheable","last_synced_at":"2026-05-22T05:16:19.945Z","repository":{"id":62532806,"uuid":"184660918","full_name":"railken/cacheable","owner":"railken","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-27T18:51:39.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T21:46:27.498Z","etag":null,"topics":["cache","cacheable","laravel","methods","trait"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/railken.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-02T22:26:15.000Z","updated_at":"2024-03-27T18:48:53.000Z","dependencies_parsed_at":"2022-11-02T16:01:13.742Z","dependency_job_id":null,"html_url":"https://github.com/railken/cacheable","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railken%2Fcacheable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railken%2Fcacheable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railken%2Fcacheable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railken%2Fcacheable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/railken","download_url":"https://codeload.github.com/railken/cacheable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244130281,"owners_count":20402756,"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":["cache","cacheable","laravel","methods","trait"],"created_at":"2024-11-24T05:17:40.871Z","updated_at":"2026-05-22T05:16:19.905Z","avatar_url":"https://github.com/railken.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cacheable\n\n[![Actions Status](https://github.com/railken/cacheable/workflows/Test/badge.svg)](https://github.com/railken/cacheable/actions)\n\nThis library give you the ability to call any method with a suffix `Cached` to retrieve a Cached result of the methods. This comes in handy when you have a really time consuming method and the result is always be the same given the same parameters\n\n# Requirements\n\n- PHP 8.1 and later\n- Laravel\n\n## Installation\n\nYou can install it via [Composer](https://getcomposer.org/) by typing the following command:\n\n```bash\ncomposer require railken/cacheable\n```\n\n## Usage\n\nAdd the `CacheableTrait` and `CacheableContract` in the class you wish to cache\n```php\nuse Railken\\Cacheable\\CacheableTrait;\nuse Railken\\Cacheable\\CacheableContract;\n\nclass Foo implements CacheableContract\n{\n  use CacheableTrait;\n\n  public function sum(int $x, int $y): int\n  {\n      return $x + $y;\n  }\n\n  public function random(): string\n  {\n      return str_random(10);\n  }\n}\n\n```\nNow you can play with the method\n\n```php\n$foo = new Foo();\n$foo-\u003esumCached(2, 8); // 10\n\n$foo-\u003erandomCached(); // Return always the same string\n\n```\n\nIn order to cleanup the cache simply run `php artisan cache:clean`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailken%2Fcacheable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frailken%2Fcacheable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailken%2Fcacheable/lists"}