matthiasmullie / scrapbook

PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APC(u), SQL and additional capabilities (e.g. transactions, stampede protection) built on top.
https://www.scrapbook.cash
MIT License
315 stars 27 forks source link

Fatal error: Class MatthiasMullie\Scrapbook\Psr6\Taggable\Pool contains 4 abstract methods #9

Closed dgreda closed 8 years ago

dgreda commented 8 years ago

Hello @matthiasmullie.

I'm using version 1.1.0 of scrapbook. When I'm trying to use the taggable pool, I'm getting a PHP Fatal, saying that the Pool class contains 4 abstract methods, as following:

PHP Fatal error:  Class MatthiasMullie\Scrapbook\Psr6\Taggable\Pool contains 4 abstract methods and must therefore be declared abstract or implement the remaining methods (MatthiasMullie\Scrapbook\Psr6\Taggable\Pool::getList, MatthiasMullie\Scrapbook\Psr6\Taggable\Pool::removeList, MatthiasMullie\Scrapbook\Psr6\Taggable\Pool::appendListItem, ...) in /project/vendor/matthiasmullie/scrapbook/src/Psr6/Taggable/Pool.php on line 209

What I'm trying to achieve is to simply test the Taggable pool implementation under PSR-6 test suite from PhpCache (https://github.com/php-cache/integration-tests).

Seems that those 4 missing methods are coming from Cache\Taggable\TaggablePoolTrait and your Pool implementation is missing them.

matthiasmullie commented 8 years ago

Hi @dgreda

It seems that, with 0.4.0, cache/taggable cache have introduced TaggablePSR6PoolAdapter::makeTaggable, which does roughly the same as Scrapbook's taggable cache did: accept any PSR-6 CacheItemPoolInterface & make it a TaggablePoolInterface.

So I'm going to delete that part from the Scrapbook suite, as it is no longer needed. I believe cache/taggable-cache (where the interface comes from) is best placed to also provide the implementation (as evidenced here: an update there broke this implementation)

You should still be able to use a Scrapbook cache for taggable cache purposes, though. But now wrapped inside TaggablePSR6PoolAdapter::makeTaggable, like this:

$cache = new \MatthiasMullie\Scrapbook\Adapters\MemoryStore();
$pool = new \MatthiasMullie\Scrapbook\Psr6\Pool($cache);
$taggable = TaggablePSR6PoolAdapter::makeTaggable($pool);