Drupal PSR Cache

Categories

Component ID

2454261

Component name

Drupal PSR Cache

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

340

Component created

Component changed

Component body

Drupal PSR Cache

PSR compliant cache for Drupal using the Drupal cache API.

It contains a static cache proxy in order to stack cache pools together.

Install

  • download the module
  • run composer in the module folder: composer update
  • enable module

Usage

Fetching a cached item:

$cachePool = new DrupalPSRCacheCachePool();
$cacheItem = $cachePool->getItem('foo');
var_dump($cacheItem->get());

Setting an element:

$cachePool = new DrupalPSRCacheCachePool();
$cacheItem->set(['foo' => 'bar']);
$cachePool->save($cacheItem);

Using the static cache proxy:

$cachePool = new DrupalPSRCacheCachePool();
$staticCache = new DrupalPSRCacheStaticCacheProxy($cachePool);
$cacheItem = $staticCache->getItem('foo');
var_dump($cacheItem->get());