https://github.com/thecodingmachine/psr-6-doctrine-bridge-universal-module
Cross-framework module for cache/psr-6-doctrine-bridge
https://github.com/thecodingmachine/psr-6-doctrine-bridge-universal-module
Last synced: 3 months ago
JSON representation
Cross-framework module for cache/psr-6-doctrine-bridge
- Host: GitHub
- URL: https://github.com/thecodingmachine/psr-6-doctrine-bridge-universal-module
- Owner: thecodingmachine
- Created: 2016-05-30T14:33:17.000Z (about 10 years ago)
- Default Branch: 1.1
- Last Pushed: 2017-09-25T12:06:46.000Z (over 8 years ago)
- Last Synced: 2025-02-16T12:30:29.440Z (over 1 year ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 0
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/thecodingmachine/psr-6-doctrine-bridge-universal-module)
[](https://coveralls.io/github/thecodingmachine/psr-6-doctrine-bridge-universal-module?branch=1.1)
# PSR6 to Doctrine cache universal module
This package integrates [cache/psr-6-doctrine-bridge](https://github.com/php-cache/doctrine-bridge) (the bridge between Doctrine cache and PSR-6) in any [container-interop/service-provider](https://github.com/container-interop/service-provider) compatible framework/container.
## Installation
```
composer require thecodingmachine/psr-6-doctrine-bridge-universal-module
```
Once installed, you need to register the [`TheCodingMachine\DoctrineCacheBridgeServiceProvider`](src/DoctrineCacheBridgeServiceProvider.php) into your container.
If your container supports thecodingmachine/discovery integration, you have nothing to do. Otherwise, refer to your framework or container's documentation to learn how to register *service providers*.
## Introduction
This service provider will provide a default Doctrine cache implementation based on the already configured PSR-6 cache.
It assumes there is already a configured service providing a PSR-6 cache pool. You can install a service provider providing this service using:
```
composer require thecodingmachine/stash-universal-module
```
(this will install Stash and its related service-provider. Stash is a PSR-6 caching library)
### Usage
```php
use Doctrine\Common\Cache\CacheProvider;
$cachePool = $container->get(CacheProvider::class);
echo $cachePool->get('my_cached_value');
```
## Expected values / services
This *service provider* expects the following configuration / services to be available:
| Name | Compulsory | Description |
|-----------------|------------|----------------------------------------|
| `CacheItemPoolInterface::class` | *yes* | A PSR-6 compatible cache pool. |
## Provided services
This *service provider* provides the following services:
| Service name | Description |
|-----------------------------|--------------------------------------|
| `Doctrine\Common\Cache\CacheProvider` | A Doctrine cache, this is actually a bridge to the PSR-6 pool. |
| `Doctrine\Common\Cache\Cache` | An alias to the `CacheProvider`. |
## Extended services
This *service provider* does not extend any service.