{"id":22018340,"url":"https://github.com/biohzrdmx/cacher-php","last_synced_at":"2026-04-30T17:32:16.969Z","repository":{"id":33238807,"uuid":"36883135","full_name":"biohzrdmx/cacher-php","owner":"biohzrdmx","description":"A simple, general-purpose, file-based cache provider","archived":false,"fork":false,"pushed_at":"2021-03-31T16:23:33.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-29T09:52:04.626Z","etag":null,"topics":["cache","file-cache","php"],"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/biohzrdmx.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":"2015-06-04T16:43:25.000Z","updated_at":"2021-04-15T18:46:51.000Z","dependencies_parsed_at":"2022-08-17T22:45:21.478Z","dependency_job_id":null,"html_url":"https://github.com/biohzrdmx/cacher-php","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/biohzrdmx/cacher-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biohzrdmx%2Fcacher-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biohzrdmx%2Fcacher-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biohzrdmx%2Fcacher-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biohzrdmx%2Fcacher-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biohzrdmx","download_url":"https://codeload.github.com/biohzrdmx/cacher-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biohzrdmx%2Fcacher-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32472396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","file-cache","php"],"created_at":"2024-11-30T05:11:54.185Z","updated_at":"2026-04-30T17:32:16.954Z","avatar_url":"https://github.com/biohzrdmx.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"cacher-php\n=============\n\nA simple, general-purpose, file-based cache provider\n\n### Basic usage\n\nFirst require `biohzrdmx/cacher-php` with Composer.\n\nNow create a `Cacher` instance passing the cache directory and optionally, the caching time:\n\n```php\n$cacher = new Cacher(dirname(__FILE__) . '/cache');\n```\n\nOnce you've created the instance you may start manipulating the cache items, for example, by adding a new item:\n\n```php\n$cacher-\u003estore('results', $results);\n```\n\nThe next time you need to use the `results` data, just recover them from the cache. The first thing to do is check if it exists and if it's still fresh:\n\n```php\n$cacher-\u003eisCached('results');\n```\n\nThe `isCached` method will return `true` if the data is in the cache and is fresh enough. Once you've checked it, recover its contents:\n\n```php\n$results = $cacher-\u003eretrieve('results');\n```\n\nAnd that's it. Easy peasy.\n\nUsually all those operations are executed in the following form:\n\n```php\nuse Cacher\\Cacher;\n\n$cacher = new Cacher(BASE_DIR . '/cache');\n\nif ( $cacher-\u003eisCached('results') ) {\n  $results = $cacher-\u003eretrieve('results');\n} else {\n  $results = fetchResultsFromSomeSource();\n  $cacher-\u003estore('results', $results);\n}\n```\n\nYou may also specify a serialize and unserialize callback with the `setSerializer($serializer)` and `setUnserializer($unserializer)` methods.\n\nFinally if you want to delete a cached item you may do so with the `delete($name)` function.\n\n### Licensing\n\nThis software is released under the MIT license.\n\nCopyright © 2021 biohzrdmx\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n### Credits\n\n**Lead coder:** biohzrdmx [github.com/biohzrdmx](http://github.com/biohzrdmx)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiohzrdmx%2Fcacher-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiohzrdmx%2Fcacher-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiohzrdmx%2Fcacher-php/lists"}