roave/doctrine-simplecache

Doctrine Cache adapter for PSR-16 Simple Cache

Maintainers

👁 asgrim

Package info

github.com/Roave/DoctrineSimpleCache

pkg:composer/roave/doctrine-simplecache

Statistics

Installs: 1 367 337

Dependents: 1

Suggesters: 0

Stars: 55

Open Issues: 11

2.8.0 2024-02-06 18:40 UTC

Requires

Requires (Dev)

Suggests

None

Conflicts

None

Replaces

None

MIT 944e6f9e3e977552239dfc0914c254b39d9314dc

  • James Titcumb <james.woop@asgrim.com>

README

👁 Build Status
👁 Scrutinizer Code Quality
👁 Code Coverage
👁 Latest Stable Version
👁 License

PSR-16 SimpleCache implementation that accepts a Doctrine Cache and adapts it for the PSR-16 standards.

Installation

This will install doctrine/cache if not already installed.

$ composer require roave/doctrine-simplecache

Usage

Create your Doctrine Cache the usual way and inject it into SimpleCacheAdapter, for example:

<?php

namespace App;

use Psr\Container\ContainerInterface;
use Psr\SimpleCache\CacheInterface as PsrCacheInterface;
use Roave\DoctrineSimpleCache\SimpleCacheAdapter;
use Doctrine\Common\Cache\RedisCache;

final class MyCacheFactory
{
 public function __invoke(ContainerInterface $container) : PsrCacheInterface
 {
 return new SimpleCacheAdapter(new RedisCache());
 }
}

Upgrade Guide

BC Breaks in 2.0

  • Support for MultiOperationCache added, includes support for deleteMultiple in Doctrine 1.7 breaks:
    • CacheException static constructors fromNonMultiGetCache and fromNonMultiPutCache have been replaced with fromNonMultiOperationCache.
    • SimpleCacheAdapter now requires an adapter implementing MultiOperationCache, and no longer specifically requires a cache implementing MultiGetCache or MultiPutCache explicitly.