{"id":18321796,"url":"https://github.com/chillerlan/php-cache","last_synced_at":"2025-04-05T22:32:30.566Z","repository":{"id":11470435,"uuid":"69774941","full_name":"chillerlan/php-cache","owner":"chillerlan","description":"A psr/simple-cache (PSR-16) implementation","archived":false,"fork":false,"pushed_at":"2024-03-06T23:37:23.000Z","size":391,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T13:21:49.572Z","etag":null,"topics":["cache","memcached","php","php-library","php7","psr-16","redis","simple-cache"],"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/chillerlan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"codemasher","custom":"https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4"}},"created_at":"2016-10-02T02:29:44.000Z","updated_at":"2025-03-09T06:50:03.000Z","dependencies_parsed_at":"2024-03-08T20:48:43.278Z","dependency_job_id":null,"html_url":"https://github.com/chillerlan/php-cache","commit_stats":{"total_commits":91,"total_committers":3,"mean_commits":"30.333333333333332","dds":0.03296703296703296,"last_synced_commit":"e57f4711959d4ad69173c26cce1a0b9f6bac6e1d"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chillerlan%2Fphp-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chillerlan%2Fphp-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chillerlan%2Fphp-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chillerlan%2Fphp-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chillerlan","download_url":"https://codeload.github.com/chillerlan/php-cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411234,"owners_count":20934650,"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","memcached","php","php-library","php7","psr-16","redis","simple-cache"],"created_at":"2024-11-05T18:21:38.072Z","updated_at":"2025-04-05T22:32:30.247Z","avatar_url":"https://github.com/chillerlan.png","language":"PHP","readme":"# chillerlan/php-cache\n\nA psr/simple-cache implementation for PHP 8.1+.\n\n[![PHP Version Support][php-badge]][php]\n[![version][packagist-badge]][packagist]\n[![license][license-badge]][license]\n[![Coverage][coverage-badge]][coverage]\n[![Codacy][codacy-badge]][codacy]\n[![Packagist downloads][downloads-badge]][downloads]\u003cbr/\u003e\n[![Continuous Integration][gh-action-badge]][gh-action]\n\n[php-badge]: https://img.shields.io/packagist/php-v/chillerlan/php-cache?logo=php\u0026color=8892BF\n[php]: https://www.php.net/supported-versions.php\n[packagist-badge]: https://img.shields.io/packagist/v/chillerlan/php-cache.svg?logo=packagist\n[packagist]: https://packagist.org/packages/chillerlan/php-cache\n[license-badge]: https://img.shields.io/github/license/chillerlan/php-cache.svg\n[license]: https://github.com/chillerlan/php-cache/blob/master/LICENSE\n[coverage-badge]: https://img.shields.io/codecov/c/github/chillerlan/php-cache.svg?logo=codecov\n[coverage]: https://codecov.io/github/chillerlan/php-cache\n[codacy-badge]: https://img.shields.io/codacy/grade/69b19ba81ae6492f973c4f05b92884aa/main?logo=codacy\n[codacy]: https://app.codacy.com/gh/chillerlan/php-cache/dashboard?branch=main\n[downloads-badge]: https://img.shields.io/packagist/dt/chillerlan/php-cache.svg?logo=packagist\n[downloads]: https://packagist.org/packages/chillerlan/php-cache/stats\n[gh-action-badge]: https://github.com/chillerlan/php-cache/workflows/Continuous%20Integration/badge.svg\n[gh-action]: https://github.com/chillerlan/php-cache/actions\n\n## Features:\n- [PSR-16 simple-cache-implementation](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-16-simple-cache.md)\n  - persistent: File based, Memcached, Redis\n  - non-persistent: Session, Memory\n\n## Requirements\n- **PHP 8.1+**\n  - optionally one of the following extensions\n    - [Memcached](https://www.php.net/manual/en/book.memcached.php)\n    - [Redis](https://github.com/phpredis/phpredis/)\n    - [APCU](https://www.php.net/manual/en/book.apcu.php)\n\n## Documentation\n### Installation using [composer](https://getcomposer.org)\nYou can simply clone the repo and run `composer install` in the root directory.\nIn case you want to include it elsewhere, just add the following to your *composer.json*:\n\n(note: replace `dev-main` with a [version constraint](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints),\n e.g. `^4.1` - see [releases](https://github.com/chillerlan/php-cache/releases) for valid versions)\n```json\n{\n\t\"require\": {\n\t\t\"php\": \"^8.1\",\n\t\t\"chillerlan/php-cache\": \"dev-main\"\n\t}\n}\n```\n\nInstallation via terminal: `composer require chillerlan/php-cache`\n\nProfit!\n\n### Usage\nJust invoke a cache instance with the desired `CacheInterface` like so:\n```php\n// Redis\n$redis = new Redis;\n$redis-\u003epconnect('127.0.0.1', 6379);\n\n$cache = new RedisCache($redis);\n\n// Memcached\n$memcached = new Memcached('myCacheInstance');\n$memcached-\u003eaddServer('localhost', 11211);\n\n$cache = new MemcachedCache($memcached);\n\n// APCU\n$cache = new APCUCache;\n\n// File\n$cache = new FileCache(new CacheOptions(['cacheFilestorage' =\u003e __DIR__.'/../.cache']));\n\n// Session\n$cache = new SessionCache(new CacheOptions(['cacheSessionkey' =\u003e '_my_session_cache']));\n\n// Memory\n$cache = new MemoryCache;\n```\n\n#### Methods\nSee: [`Psr\\SimpleCache\\CacheInterface`](https://github.com/php-fig/simple-cache/blob/master/src/CacheInterface.php)\n\n```php\n$cache-\u003eget(string $key, $default = null); // -\u003e mixed\n$cache-\u003eset(string $key, $value, int $ttl = null):bool\n$cache-\u003edelete(string $key):bool\n$cache-\u003ehas(string $key):bool\n$cache-\u003eclear():bool\n$cache-\u003egetMultiple(array $keys, $default = null):array // -\u003e mixed[]\n$cache-\u003esetMultiple(array $values, int $ttl = null):bool\n$cache-\u003edeleteMultiple(array $keys):bool\n```\n\n## Disclaimer!\nI don't take responsibility for molten memory modules, bloated hard disks, self-induced DoS, broken screens etc. Use at your own risk! :see_no_evil:\n","funding_links":["https://ko-fi.com/codemasher","https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchillerlan%2Fphp-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchillerlan%2Fphp-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchillerlan%2Fphp-cache/lists"}