{"id":19398104,"url":"https://github.com/piedweb/filecache","last_synced_at":"2026-05-15T00:42:24.155Z","repository":{"id":57041408,"uuid":"164328757","full_name":"PiedWeb/FileCache","owner":"PiedWeb","description":"[PHP] Permit to manage data in a file. Simple, Static and Intuitive.","archived":false,"fork":false,"pushed_at":"2019-01-16T07:13:40.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-07T11:12:14.592Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://dev.piedweb.com/","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/PiedWeb.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-01-06T17:15:49.000Z","updated_at":"2019-01-16T07:13:41.000Z","dependencies_parsed_at":"2022-08-23T23:31:13.173Z","dependency_job_id":null,"html_url":"https://github.com/PiedWeb/FileCache","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiedWeb%2FFileCache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiedWeb%2FFileCache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiedWeb%2FFileCache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiedWeb%2FFileCache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PiedWeb","download_url":"https://codeload.github.com/PiedWeb/FileCache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240571029,"owners_count":19822412,"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":[],"created_at":"2024-11-10T11:04:53.903Z","updated_at":"2025-11-18T00:03:57.865Z","avatar_url":"https://github.com/PiedWeb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# File Cache\n\n[![Latest Version](https://img.shields.io/github/tag/PiedWeb/FileCache.svg?style=flat\u0026label=release)](https://github.com/PiedWeb/FileCache/tags)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](https://github.com/PiedWeb/FileCache/blob/master/LICENSE)\n[![Build Status](https://img.shields.io/travis/PiedWeb/FileCache/master.svg?style=flat)](https://travis-ci.org/PiedWeb/FileCache)\n[![Quality Score](https://img.shields.io/scrutinizer/g/PiedWeb/FileCache.svg?style=flat)](https://scrutinizer-ci.com/g/PiedWeb/FileCache)\n[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/PiedWeb/FileCache.svg?style=flat)](https://scrutinizer-ci.com/g/PiedWeb/FileCache/code-structure)\n[![Total Downloads](https://img.shields.io/packagist/dt/piedweb/file-cache.svg?style=flat)](https://packagist.org/packages/piedweb/file-cache)\n\nSimple file cache library. Tested and approved. Intuitive and documented (inline and in this Readme).\n\n## Install\n\nVia [Packagist](https://img.shields.io/packagist/dt/piedweb/file-cache.svg?style=flat)\n\n``` bash\n$ composer require piedweb/file-cache\n```\n\n## Usage\n\n``` php\nuse PiedWeb\\FileCache\\FileCache;\n\n$key = 'data-2032'; // string to identify the cached data\n$maxAge = 3600;     // 1 hour\n$folder = './cache';\n$prefix = 'tmp_';\n$data = 'example data, but can be an int or an array which will be serialized'\n\n/** Create a cache file **/\nFileCache::instance()-\u003esetPrefix($folder) // Useful when you want to delete every cached data of the same type\nFileCache::instance()-\u003esetCacheFolder($pregix)\n\n\nFileCache::instance($folder, $prefix)-\u003eset($key, 'My string to set in a cache || But it could be an array or an object...');\nFileCache::instance($folder, $prefix)-\u003eget($key, $maxAge);\nFileCache::instance($folder, $prefix)-\u003eget($key, 0);  // Always valid. No expiration\nFileCache::instance($folder, $prefix)-\u003egetElseCreate($key , $maxAge, function() { return ['My first data in cache']; });\n\n/** Delete all cache files with the prefix `prfixForCacheFiles_` **/\nFileCache::instance($folder, $prefix)-\u003edeleteCacheFilesByPrefix();\n```\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Contributing\n\nPlease see [contributing](https://dev.piedweb.com/contributing)\n\n## Credits\n\n- [PiedWeb](https://piedweb.com)\n- [All Contributors](https://github.com/PiedWeb/:package_skake/graphs/contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\n[![Latest Version](https://img.shields.io/github/tag/PiedWeb/FileCache.svg?style=flat\u0026label=release)](https://github.com/PiedWeb/FileCache/tags)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](https://github.com/PiedWeb/FileCache/blob/master/LICENSE)\n[![Build Status](https://img.shields.io/travis/PiedWeb/FileCache/master.svg?style=flat)](https://travis-ci.org/PiedWeb/FileCache)\n[![Quality Score](https://img.shields.io/scrutinizer/g/PiedWeb/FileCache.svg?style=flat)](https://scrutinizer-ci.com/g/PiedWeb/FileCache)\n[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/PiedWeb/FileCache.svg?style=flat)](https://scrutinizer-ci.com/g/PiedWeb/FileCache/code-structure)\n[![Total Downloads](https://img.shields.io/packagist/dt/piedweb/file-cache.svg?style=flat)](https://packagist.org/packages/piedweb/file-cache)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiedweb%2Ffilecache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiedweb%2Ffilecache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiedweb%2Ffilecache/lists"}