https://github.com/itk-dev/drupal_psr6_cache
PSR-6: Caching Interface for Drupal 8+
https://github.com/itk-dev/drupal_psr6_cache
Last synced: 12 months ago
JSON representation
PSR-6: Caching Interface for Drupal 8+
- Host: GitHub
- URL: https://github.com/itk-dev/drupal_psr6_cache
- Owner: itk-dev
- Created: 2021-06-22T11:21:45.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-01-10T10:00:58.000Z (about 2 years ago)
- Last Synced: 2024-04-14T10:58:51.044Z (almost 2 years ago)
- Language: PHP
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# PSR-6: Caching Interface for Drupal 8+
## Installation
```shell
composer require itk-dev/drupal_psr6_cache
vendor/bin/drush pm:enable drupal_psr6_cache
```
or add a composer dependency on `itk-dev/drupal_psr6_cache` (see below for
details).
## Usage
Add a dependency on the `drupal_psr6_cache` module to a module:
```json
# composer.json
{
"name": "drupal/my_module",
…
"require": {
"itk-dev/drupal_psr6_cache": "^1.0"
}
}
```
```yml
# my_module.info.yml
…
dependencies:
- drupal:drupal_psr6_cache
```
Inject the cache pool into a service:
```yml
# my_module.services.yml
my_module.some_service:
class: Drupal/my_module/SomeService.php
arguments:
- '@drupal_psr6_cache.cache_item_pool'
```
Use the cache pool:
```php
// src/SomeService.php
namespace Drupal/my_module;
use Psr\Cache\CacheItemPoolInterface;
class SomeService {
__construct(CacheItemPoolInterface $cacheItemPool) {
…
}
}
```
## Development
### Tests
@todo
### Coding standards
The code must follow the [Drupal coding
standards](https://www.drupal.org/docs/develop/standards).
Check coding standards (run `composer install` to install the required tools):
```shell
composer coding-standards-check
```
Apply coding standards:
```shell
composer coding-standards-apply
```
## References and inspiration