{"id":15046101,"url":"https://github.com/jaredchu/simple-cache","last_synced_at":"2025-06-15T22:36:19.058Z","repository":{"id":56996598,"uuid":"99220058","full_name":"jaredchu/Simple-Cache","owner":"jaredchu","description":"Simple PHP object caching base on temp file (no additional PHP extension require)","archived":false,"fork":false,"pushed_at":"2018-05-24T10:29:37.000Z","size":46,"stargazers_count":2,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T10:25:46.927Z","etag":null,"topics":["cache","composer","composer-package","packagist","php","php7"],"latest_commit_sha":null,"homepage":"","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/jaredchu.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":"2017-08-03T10:18:37.000Z","updated_at":"2022-02-12T10:55:13.000Z","dependencies_parsed_at":"2022-08-21T10:30:07.899Z","dependency_job_id":null,"html_url":"https://github.com/jaredchu/Simple-Cache","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredchu%2FSimple-Cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredchu%2FSimple-Cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredchu%2FSimple-Cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredchu%2FSimple-Cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaredchu","download_url":"https://codeload.github.com/jaredchu/Simple-Cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238207646,"owners_count":19434095,"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","composer","composer-package","packagist","php","php7"],"created_at":"2024-09-24T20:52:42.494Z","updated_at":"2025-02-10T23:31:38.190Z","avatar_url":"https://github.com/jaredchu.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple-cache\nSimple PHP object caching base on temp file\n\n[![Packagist](https://img.shields.io/packagist/v/jaredchu/simple-cache.svg)](https://packagist.org/packages/jaredchu/simple-cache)\n[![Packagist](https://img.shields.io/packagist/dt/jaredchu/simple-cache.svg)](https://packagist.org/packages/jaredchu/simple-cache)\n[![Travis](https://img.shields.io/travis/jaredchu/Simple-Cache.svg)](https://travis-ci.org/jaredchu/Simple-Cache)\n[![Scrutinizer](https://img.shields.io/scrutinizer/g/jaredchu/Simple-Cache.svg)](https://scrutinizer-ci.com/g/jaredchu/Simple-Cache/)\n[![Codecov](https://img.shields.io/codecov/c/github/jaredchu/Simple-Cache.svg)](https://codecov.io/gh/jaredchu/simple-cache)\n[![Packagist](https://img.shields.io/packagist/l/jaredchu/simple-cache.svg)](https://packagist.org/packages/jaredchu/simple-cache)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fjaredchu%2FSimple-Cache.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fjaredchu%2FSimple-Cache?ref=badge_shield)\n\n## Installation\n`$ composer require jaredchu/simple-cache`\n\n## Usage\n\n#### Quick start\n```PHP\nuse JC\\Cache\\SimpleCache;\n\n// store your object\nSimpleCache::add('your-key', new Person('Jared', 27));\n\n// check if exists\nSimpleCache::exists('your-key');\n\n// fetch your object\n$person = SimpleCache::fetch('your-key', Person::class);\n\n// remove your cache\nSimpleCache::remove('your-key');\n```\n\n#### Add\n```PHP\n// cache object Person with lifetime 1000 seconds (default is 0, not expire)\nSimpleCache::add('your-key', new Person('Jared', 27), 1000);\n```\n#### Fetch\n```PHP\nif(SimpleCache::exists('your-key')){\n  $person = SimpleCache::fetch('your-key', Person::class);\n  $person-\u003esayHi();\n}\n```\n#### Remove\n```PHP\nSimpleCache::remove('your-key');\n```\n#### Security\n```PHP\n// your data is already encrypt but you can set your own encrypt key\nSimpleCache::setEncryptKey('your unique string');\nSimpleCache::add('your-key', new Person('Jared', 27));\n\n// you must set encrypt key again if you want to call fetch in another session\nSimpleCache::setEncryptKey('your unique string');\n$person = SimpleCache::fetch('your-key', Person::class);\n```\n\n## Contributing\n1. Fork it!\n2. Create your feature branch: `$ git checkout -b feature/your-new-feature`\n3. Commit your changes: `$ git commit -am 'Add some feature'`\n4. Push to the branch: `$ git push origin feature/your-new-feature`\n5. Submit a pull request.\n\n## License\n[MIT License](https://github.com/jaredchu/Simple-Cache/blob/master/LICENSE)\n\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fjaredchu%2FSimple-Cache.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fjaredchu%2FSimple-Cache?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredchu%2Fsimple-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredchu%2Fsimple-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredchu%2Fsimple-cache/lists"}