{"id":18929516,"url":"https://github.com/thecodingmachine/symfony-cache-universal-module","last_synced_at":"2026-03-16T14:30:18.723Z","repository":{"id":57067920,"uuid":"145304601","full_name":"thecodingmachine/symfony-cache-universal-module","owner":"thecodingmachine","description":"Cross-framework module for Symfony cache","archived":false,"fork":false,"pushed_at":"2018-08-19T13:31:50.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-16T12:30:30.110Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thecodingmachine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-19T13:15:44.000Z","updated_at":"2018-08-20T10:15:15.000Z","dependencies_parsed_at":"2022-08-24T10:20:11.988Z","dependency_job_id":null,"html_url":"https://github.com/thecodingmachine/symfony-cache-universal-module","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fsymfony-cache-universal-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fsymfony-cache-universal-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fsymfony-cache-universal-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fsymfony-cache-universal-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodingmachine","download_url":"https://codeload.github.com/thecodingmachine/symfony-cache-universal-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239927823,"owners_count":19719835,"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-08T11:33:21.312Z","updated_at":"2026-03-16T14:30:18.681Z","avatar_url":"https://github.com/thecodingmachine.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/thecodingmachine/symfony-cache-universal-module/v/stable)](https://packagist.org/packages/thecodingmachine/symfony-cache-universal-module)\n[![Latest Unstable Version](https://poser.pugx.org/thecodingmachine/symfony-cache-universal-module/v/unstable)](https://packagist.org/packages/thecodingmachine/symfony-cache-universal-module)\n[![License](https://poser.pugx.org/thecodingmachine/symfony-cache-universal-module/license)](https://packagist.org/packages/thecodingmachine/symfony-cache-universal-module)\n[![Build Status](https://travis-ci.org/thecodingmachine/symfony-cache-universal-module.svg?branch=master)](https://travis-ci.org/thecodingmachine/symfony-cache-universal-module)\n[![Coverage Status](https://coveralls.io/repos/thecodingmachine/symfony-cache-universal-module/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/thecodingmachine/symfony-cache-universal-module?branch=master)\n\n# Symfony cache universal module\n\nThis package integrates the Symfoncy Cache component in any [container-interop](https://github.com/container-interop/service-provider) compatible framework/container.\n\n## Installation\n\n```bash\n$ composer require thecodingmachine/symfony-cache-universal-module\n```\n\nOnce installed, you need to register the [`TheCodingMachine\\SymfonyCacheServiceProvider`](src/SymfonyCacheServiceProvider.php) into your container.\n\nIf your container supports [thecodingmachine/discovery](https://github.com/thecodingmachine/discovery) integration, you have nothing to do. Otherwise, refer to your framework or container's documentation to learn how to register *service providers*.\n\n## Introduction\n\nThis service provider is meant to create both PSR-16 caches `Psr\\SimpleCache\\CacheInterface` and PSR-6 cache pools `Psr\\Cache\\CacheItemPoolInterface` instance.\n\nOut of the box, the instance should be usable with sensible defaults. We tried to keep the defaults usable for most of the developer, while still providing best performances for the server:\n\n- the provided caches are made of chainable caches\n- the first level is an ArrayCache (in-memory) for fast access to already fetched values\n- the second level is an APCu cache, with a *PhpFilesCache* fallback if the APCu extension is not available.\n\nNote: the Symfony cache component provides a lot of adapters for a lot of platforms.\nThis service provider does not attempt to map all the caches provided but instead focuses on sane defaults.\n\n### PSR-16 Usage\n\n```php\nuse Psr\\SimpleCache\\CacheInterface\n\n$cache = $container-\u003eget(CacheInterface::class);\necho $cachePool-\u003eget('my_cached_value');\n```\n\n### PSR-6 Usage\n\n```php\nuse Psr\\Cache\\CacheItemPoolInterface\n\n$cachePool = $container-\u003eget(CacheItemPoolInterface::class);\necho $cachePool-\u003egetItem('my_cached_value')-\u003eget();\n```\n\n## Expected values / services\n\nThis *service provider* expects the following configuration / services to be available:\n\n| Name                        | Compulsory | Description                            |\n|-----------------------------|------------|----------------------------------------|\n| `symfony.cache.namespace`   | *no*       | The namespace for the cache. Defaults to ''.  |\n| `symfony.cache.defaultLifetime` | *no*       | The default life time for the cache. Defaults to 0 (no limit).  |\n| `symfony.cache.version`     | *no*       | The version of the cache (if changed, the cache is purged)  |\n| `symfony.cache.files.directory` | *no*       | The directory where cached files will be stored. Defaults to a directory in the temporary system directory.  |\n\n## Provided services\n\nThis *service provider* provides the following services:\n\n| Service name                | Description                          |\n|-----------------------------|--------------------------------------|\n| `CacheInterface::class`     | Alias to `ChainCache::class` |\n| `ChainCache::class`         | A composite cache that chains calls to several cache backend |\n| `symfony.cache.chained.caches` | The list of chained caches used by the `ChainCache::class` instance. This value is a `SplPriorityQueue` that can be extended easily. |\n| `ArrayCache::class`         | An in-memory cache |\n| `NullCache::class`          | A cache that caches nothing |\n| `ApcuCache::class`          | A cache with an APCu backend |\n| `PhpFilesCache::class`      | A cache with PHP files as backend |\n| `CacheItemPoolInterface::class`     | Alias to `SimpleCacheAdapter::class` |\n| `SimpleCacheAdapter::class`     | A PSR-6 =\u003e PSR-16 adapter. |\n\n\u003csmall\u003eProject template courtesy of \u003ca href=\"https://github.com/thecodingmachine/service-provider-template\"\u003ethecodingmachine/service-provider-template\u003c/a\u003e\u003c/small\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Fsymfony-cache-universal-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodingmachine%2Fsymfony-cache-universal-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Fsymfony-cache-universal-module/lists"}