Skip to content

Doctrine Cache adapter for PSR-16 Simple Cache

License

Notifications You must be signed in to change notification settings

juliangut/DoctrineSimpleCache

 
 

Repository files navigation

Doctrine SimpleCache adapter

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 Interop\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());
    }
}

Todo

  • Catch/rethrow appropriately wrapped exceptions (implementing interfaces)
  • Implementation of deleteMultiple is a bit dodgy, improve this

About

Doctrine Cache adapter for PSR-16 Simple Cache

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%