itk-dev/drupal_psr6_cache

There is no license information available for the latest version (1.1.2) of this package.

PSR-6: Caching Interface for Drupal 8+

Installs: 7 433

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:drupal-module

1.1.2 2024-01-10 10:00 UTC

This package is auto-updated.

Last update: 2024-11-10 11:41:23 UTC


README

Installation

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:

# composer.json
{
    "name": "drupal/my_module",
    
    "require": {
        "itk-dev/drupal_psr6_cache": "^1.0"
    }
}
# my_module.info.yml

dependencies:
  - drupal:drupal_psr6_cache

Inject the cache pool into a service:

# 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:

// 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.

Check coding standards (run composer install to install the required tools):

composer coding-standards-check

Apply coding standards:

composer coding-standards-apply

References and inspiration

https://git.drupalcode.org/project/drupal_psr_cache